AIO Speedtest is a library written in Python to perform speed tests asynchronously and programmatically.
This project was made based on the existing Speedtest from which we shared several code snippets, what I did were few modifications to work asynchronously.
Basic Usage
import asyncio
from aiotestspeed.aio import Speedtest
units = ('bit', 1)
async def main():
s: Speedtest = await Speedtest()
await s.get_best_server()
await s.download()
await s.upload()
print('Ping: %s ms\nDownload: %0.2f M%s/s\nUpload: %0.2f M%s/s' %
(s.results.ping,
(s.results.download / 1000.0 / 1000.0) / units[1],
units[0],
(s.results.upload / 1000.0 / 1000.0) / units[1],
units[0]))
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
class Speedtest(aiobject):
async def __init__(self, config=None, source_address=None, timeout=10, secure=False):
...
@property
async def best(self) -> dict:
...
async def get_config(self) -> dict:
"""Download the speedtest.net configuration and return only the data
we are interested in
"""
...
async def get_servers(self, servers: list = None, exclude: list = None) -> list:
"""Retrieve a the list of speedtest.net servers, optionally filtered
to servers matching those specified in the ``servers`` argument
"""
...
async def set_mini_server(self, server: str) -> list:
"""Instead of querying for a list of servers, set a link to a
speedtest mini server
"""
...
async def get_closest_servers(self, limit: int = 5) -> None:
"""Limit servers to the closest speedtest.net servers based on
geographic distance.
"""
...
async def get_best_server(self, servers=None) -> dict:
"""Perform a speedtest.net "ping" to determine which speedtest.net
server has the lowest latency.
Args:
servers ([type], optional): [description]. Defaults to None.
Raises:
SpeedtestBestServerFailure: [description]
Returns:
dict: [description]
"""
...
async def download(self, callback=do_nothing) -> int:
"""Test download speed against speedtest.net
Args:
callback ([type], optional): [description]. Defaults to do_nothing.
Returns:
int: [description]
"""
...
async def upload(self, callback=do_nothing, pre_allocate: bool = True) -> int:
"""Test upload speed against speedtest.net
Args:
callback ([type], optional): [description]. Defaults to do_nothing.
pre_allocate (bool, optional): [description]. Defaults to True.
Returns:
int: [description]
"""
...
Changelog
Metadata
Release files for aiotestspeed 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiotestspeed-0.0.1.tar.gz | 16.7 kB | Without provenance | Details for aiotestspeed-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiotestspeed-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for aiotestspeed-0.0.1-py3-none-any.whl |
Total release size: 36.9 kB
Release files / aiotestspeed-0.0.1.tar.gz
| Download URL | aiotestspeed-0.0.1.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d66023806763ba0c072711c569a29dbb56817dc6c9976bcb1decd9005877efbf
|
|
BLAKE2b-256 checksum How to use checksums |
11cd1965a0591758659535a97b95dd3cd482c3e0c2795eee3a21758c5eef860f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.5
|
Release files / aiotestspeed-0.0.1-py3-none-any.whl
| Download URL | aiotestspeed-0.0.1-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfbe2436d89c01cdec9dce2698117728525b7ad9f3ec58e8b8541181a5d07cb1
|
|
BLAKE2b-256 checksum How to use checksums |
0c97f185554fecfeb274126bd794a3515497053049dc3ce0df17e9fe12c81a2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.5
|
Security for aiotestspeed 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.