Package: netmeasure
NetmeasureA CLI tool and Python library for measuring Internet connection quality in a structured and consistent way.PurposeMany services, clients, tools, and methodologies exist to measure Internet connection quality. Each of these has particular advantages, flaws, biases and units of measurement.netmeasurebrings together a variety of Internet connection quality measurements in a single package, with a consistent interface and explicitly-defined units.An open-source license ensures methodology is transparent and open to ongoing community improvement.Requirementsnetmeasuresupports Python 3.8 to Python 3.11 inclusively.CLI toolnetmeasurecan be used to run measurements directly from the command line.InstallationInstall withpipx:$pipxinstallnetmeasureUsageUsenetmeasure --helpto see a list of available measurements:Usage:netmeasure[OPTIONS]COMMAND1[ARGS]...[COMMAND2[ARGS]...]...Internetconnectionqualitymeasurements.

Options:-v,--verbose--helpShowthismessageandexit.

Commands:file_downloadPerformafiledownloadmeasurement.ip_routePerformaniproutemeasurement.latencyPerformalatencymeasurement.netflix_fastPerformaNetflixfast.commeasurement.speedtest_dotnetPerformaspeedtest.netmeasurement.webpage_downloadPerformawebpagedownloadmeasurement.youtube_downloadPerformayoutubedownloadmeasurement.Usenetmeasure <measurement> --helpfor details for a specific measurement:netmeasurenetflix_fast--help
Usage:netmeasurenetflix_fast[OPTIONS]PerformaNetflixfast.commeasurement.

Options:--helpShowthismessageandexit.$netmeasurenetflix_fast

─────────────────────────────────────────────────────────────────────────────────────────────────────────────
🍿NetflixFast🍿
Host0:ipv4-c003-syd001-superloop-isp.1.oca.nflxvideo.net|Country:AU|City:Alexandria
Host1:ipv4-c004-syd002-superloop-isp.1.oca.nflxvideo.net|Country:AU|City:Sydney
Host2:ipv4-c001-meb002-superloop-isp.1.oca.nflxvideo.net|Country:AU|City:PortMelbourne
DownloadRate:25393008.677629545bit/s|DownloadSize:54657024.0B
─────────────────────────────────────────────────────────────────────────────────────────────────────────────Measurements can be performed sequentially by chaining commands:$netmeasure\netflix_fast\latency--host1.1.1.1
speedtest_dotnet

─────────────────────────────────────────────────────────────────────────────────────────────────────────────
🍿NetflixFast🍿
Host0:ipv4-c003-syd001-superloop-isp.1.oca.nflxvideo.net|Country:AU|City:Alexandria
Host1:ipv4-c004-syd002-superloop-isp.1.oca.nflxvideo.net|Country:AU|City:Sydney
Host2:ipv4-c001-meb002-superloop-isp.1.oca.nflxvideo.net|Country:AU|City:PortMelbourne
DownloadRate:25393008.677629545bit/s|DownloadSize:54657024.0B
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
🏓Latency🏓
Host:1.1.1.1
MinimumLatency:4.403ms|AverageLatency:107.408ms|MaximumLatency:313.408ms|MedianDeviation:145.663ms
PacketsTransmitted:3|PacketsReceived:3|PacketsLost:0.0%
ElapsedTime:2002.0ms
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
⚡SpeedtestDotnet⚡
Host:st-syd-02.gcomm.com.au:8080|Name:Sydney|ID:29570|Sponsor:NexonAsiaPacific
DownloadRate:25007776.530098625bit/s|UploadRate:19202829.854627796bit/s
─────────────────────────────────────────────────────────────────────────────────────────────────────────────Librarynetmeasurecan be used as a library to run measurements and obtain structured results from within your application.InstallationInstall from PyPI:$pipinstall-UnetmeasureUsageimportuuidfrompprintimportpprint# Import the required measurement.fromnetmeasure.measurements.latency.measurementsimportLatencyMeasurement# Create a measurement.# Note: A measurement requires an id. This id will be added to all results# generated by this measurement instance.my_latency_measurement=LatencyMeasurement(id=str(uuid.uuid4()),host='1.1.1.1')# Run the measurement.my_result=my_latency_measurement.measure()# Print the measurement result(s)pprint(my_result)[LatencyMeasurementResult(id='fb6f0c59-e6dc-4f3f-8139-c8b4b2d94871'),errors=[],host='1.1.1.1',minimum_latency=3.939,average_latency=4.195,maximum_latency=4.361,median_deviation=0.164,packets_transmitted=4,packets_received=4,packets_lost=0.0,packets_lost_unit=<RatioUnit.percentage:'%'>,elapsed_time=3004.0,elapsed_time_unit=<TimeUnit.millisecond:'ms'>)]Take a look at the commands defined innetmeasure/cli.pyfor more examples.MeasurementsThe following measurements are currently available:file_download- measures download of a file from a given endpoint using thewgetapplication.ip_route- measures network hops to a given endpoint using thescapylibrary.latency- measures latency to a given endpoint using thepingapplication.netflix_fast- measures download from thenetflix fastservice using therequestslibrary.speedtest_dotnet- measures download from, upload to and latency to thespeedtest.netservice using thespeedtest-clilibrary.webpage_download- measures download of a given web page and its associated assets using therequestslibrary.youtube_download- measures download of a givenyoutubevideo using theyoutube-dllibrary.Note: Some measurements require particular cli tools to be installedDevelopmentGit hookspre-commithooks are included to ensure code quality
oncommitandpush. Install these hooks like so:$pre-commitinstall&&pre-commitinstall-tpre-push