ppizarror / pyfastcom

Python API that gets the results from fast.com test using Selenium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fastcom

@ppizarror License MIT Python 3.4+ PyPi package Open issues https://pypi.org/project/pyfastcom/

Python API that gets the results from fast.com test using Selenium.

Install

pyfastcom can be installed via pip. Simply run:

pip install pyfastcom

Usage

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.

Author

Pablo Pizarro R. | 2020

License

This project is licensed under MIT https://opensource.org/licenses/MIT/

About

Python API that gets the results from fast.com test using Selenium

License:MIT License


Languages

Language:Python 99.3%Language:Batchfile 0.7%