https://github.com/rishabkumar7/speedtest-api
A Web API built with flask to perform internet speed test.
https://github.com/rishabkumar7/speedtest-api
api flask python python3
Last synced: 6 months ago
JSON representation
A Web API built with flask to perform internet speed test.
- Host: GitHub
- URL: https://github.com/rishabkumar7/speedtest-api
- Owner: rishabkumar7
- License: mit
- Created: 2023-05-04T17:57:25.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-02T18:29:20.000Z (over 2 years ago)
- Last Synced: 2025-01-11T18:47:37.976Z (about 1 year ago)
- Topics: api, flask, python, python3
- Language: HTML
- Homepage: https://speedtest.rishab.cloud
- Size: 97.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flask Speedtest API
This is a Flask app that provides an API for running a speedtest and returning the download and upload speeds in Mbps. The app also includes an index page with a button to run the speedtest and display the results.
## Prerequisites
- Python 3.6 or higher
- Flask
- speedtest-cli
## Installation
1. Clone this repository:
``` bash
git clone https://github.com/rishabkumar7/speedtest-api.git`
```
2.Install the required packages:
``` bash
pip install -r requirements.txt
```
3.Run the app:
``` bash
python app.py
```
4.Visit `http://localhost:5000` in your web browser to view the index page.
## Usage
To run the speedtest and get the results in JSON format, make a GET request to the `/speedtest` endpoint. For example:
```bash
curl http://localhost:5000/speedtest
```
The response will be in JSON format and will include the download and upload speeds in Mbps:
```json
{
"download_speed": 25.56,
"upload_speed": 10.23
}
```
To view the index page, visit the root URL `http://localhost:5000`. Click the "Run Speedtest" button to start the speedtest and display the results.
## Deployment
This app can be deployed to a cloud hosting platform such as AWS, Azure, or GCP.
## Credits
This app uses the `speedtest-cli` library for running the speedtest. The animated GIF used for the loading spinner was sourced from [Giphy](https://giphy.com/).
## License
This project is licensed under the MIT License. See the [LICENSE]() file for details.