Skip to main content

Asynchronous python library to test connection speed, based on the speedtest project.

Project description

AIO Speedtest

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.upload()
    print('Ping: %s ms\nDownload: %0.2f M%s/s\nUpload: %0.2f M%s/s' %
          ( / 1000.0 / 1000.0) / units[1],
          (s.results.upload / 1000.0 / 1000.0) / units[1],

loop = asyncio.get_event_loop()
class Speedtest(aiobject):

    async def __init__(self, config=None, source_address=None, timeout=10, secure=False):

    async def best(self) -> dict:

    async def get_config(self) -> dict:
        """Download the 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 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 servers based on
        geographic distance.

    async def get_best_server(self, servers=None) -> dict:
        """Perform a "ping" to determine which
        server has the lowest latency.

            servers ([type], optional): [description]. Defaults to None.

            SpeedtestBestServerFailure: [description]

            dict: [description]

    async def download(self, callback=do_nothing) -> int:
        """Test download speed against

            callback ([type], optional): [description]. Defaults to do_nothing.

            int: [description]

    async def upload(self, callback=do_nothing, pre_allocate: bool = True) -> int:
        """Test upload speed against

            callback ([type], optional): [description]. Defaults to do_nothing.
            pre_allocate (bool, optional): [description]. Defaults to True.

            int: [description]


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiotestspeed-0.0.1.tar.gz (16.7 kB view hashes)

Uploaded source

Built Distribution

aiotestspeed-0.0.1-py3-none-any.whl (20.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page