Python API that gets the results from fast.com test using Selenium.
pyfastcom can be installed via pip. Simply run:
pip install pyfastcom
To create a searcher object, use the PyFastCom class:
from pyfastcom import PyFastCom
fast = PyFastCom()
To configure the path of the webdriver (Chrome as for now):
fast.set_driver_path('path/to/webdriver/executable/')
Then, execute the .run(timeout=120)
method. This function takes the timeout as an input. That is the maximum number of seconds before throwing an Exception. By default, the timeout is 240 s (2 minutes). The function returns the following dictionary:
results = fast.run()
print(results) # {'client_ip': 'XXX', 'client_isp': 'XXX', 'client_location': 'XXX', 'download': (100, 'Mbps'), 'latency_download': (1, 'ms'), 'latency_upload': (1, 'ms'), 'server_info': 'XXX', 'upload': (100, 'Mbps')}
Also, the results can be obtained through the following methods:
- PyFastCom.get_client_ip(): Returns the client IP, str
- PyFastCom.get_client_isp(): Returns the client ISP, str
- PyFastCom.get_client_location(): Returns the client location, str
- PyFastCom.get_download_speed(): Returns the download speed, (int, str)
- PyFastCom.get_download_latency(): Returns the download latency, (int, str)
- PyFastCom.get_upload_speed(): Returns the upload speed, (int, str)
- PyFastCom.get_upload_latency(): Returns the upload latency, (int, str)
- PyFastCom.get_server_info(): Returns the server info, str
- PyFastCom.ready(): Returns true if the results exists, bool
Check out the provided example.py to see the complete usage scenario.
Pablo Pizarro R. | 2020
This project is licensed under MIT https://opensource.org/licenses/MIT/