Giter Site home page Giter Site logo

speedtest.py's Introduction

๐Ÿ›œ Speedtest.py

This project is not an offical Speedtest wrapper and therefore is not endorsed by Ookla.

Speedtest.py is a simple asynchronous wrapper for Speedtest.net built around the OOP coding style. We also use zero external packages/modules.


๐Ÿ“ฅ Installing

Speedtest.py requires the Speedtest.net CLI to function.


PIP: pip install speedtest.py

We're in the works of publishing to PIP.


Conda: conda install speedtest.py

We're currently not published on Conda

โœจ Example

Examples of using Speedtest.py

1: Basic speedtest

# Imports
from speedtest import Client
import asyncio

# Define the client
client = Client(
  executable="speedtest"  # Only needs changing on Windows or Linux installs that have a different executable/command name.
)

# Define app function
async def app():
  # Run a test with an automatically picked server
  result = await client.test()

  # Print statistics
  print(f"Download bandwidth:  {str(result.download.bandwidth) * 8 / 1_000_000:.2f} Mbps")
  print(f"Upload bandwidth:  {str(result.upload.bandwidth) * 8 / 1_000_000:.2f} Mbps")


asyncio.run(app())

2: Speedtest with selected server

# Imports
from speedtest import Client
import asyncio

# Define the client
client = Client(
  executable="speedtest"  # Only needs changing on Windows or Linux installs that have a different executable/command name.
)

# Define app function
async def app():
  # Get a list of nearby servers
  servers = await client.servers()

  # Run a test with the first server
  result = await client.test(server=servers[0])

  # Print statistics
  print(f"Download bandwidth:  {str(result.download.bandwidth) * 8 / 1_000_000:.2f} Mbps")
  print(f"Upload bandwidth:  {str(result.upload.bandwidth) * 8 / 1_000_000:.2f} Mbps")


asyncio.run(app())

๐Ÿ“ˆ Star History

Star History Chart

speedtest.py's People

Contributors

notaussie avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.