Compare commits

...

79 Commits

Author SHA1 Message Date
Adam Cruz
e715ef3008 Update 'README.rst' 2018-06-10 06:11:23 +08:00
Adam Cruz
9384255634 Update 'README.rst' 2018-06-10 06:10:39 +08:00
Matt Martz
72ed585c6f Bump to v2.0.2 2018-05-24 11:06:29 -05:00
Matt Martz
41e599f9c3 Ensure we are utilizing the context created by HTTPSConnection, or falling back to ssl. Fixes #517 2018-05-24 09:37:39 -05:00
Matt Martz
c7530bb143 Bump to 2.0.1 for release 2018-05-23 15:26:20 -05:00
Matt Martz
4ceae77401 Handle virtualenv and tox versions for py2.6/3.3 2018-05-22 16:38:10 -05:00
Matt Martz
9e185e8f88 Properly handle older HTTPSConnection. Fixes #513 2018-05-22 15:28:00 -05:00
Matt Martz
9c2977acfc Gracefully handle XML parsing errors. Fixes #490 #491 2018-03-09 09:46:10 -06:00
Matt Martz
f8aa20ecdf Move results.share() to ensure csv and json have access to it. Fixes #483 2018-02-20 14:59:08 -06:00
Matt Martz
8ff923b0fb Bump to 2.0.1a 2018-02-13 16:22:23 -06:00
Matt Martz
35c3ee20ed Exit with nicer error if lat/lon is not valid 2018-02-13 16:21:57 -06:00
Matt Martz
0a7823db7a Tested through 3.7 2018-02-05 16:33:07 -06:00
Matt Martz
27a8301192 Replace downloads badge with travis 2018-02-05 16:33:01 -06:00
Matt Martz
ee2e647b9b Remove deprecated speedtest_cli.py 2018-02-05 16:25:59 -06:00
Matt Martz
831c079113 Bump for release 2018-02-05 16:17:03 -06:00
Matt Martz
4f4c1dd8d1 Update man page 2018-02-05 16:16:51 -06:00
Matt Martz
2c847a1849 Add some guard code for places where sys.stdout and stderr are replaced with some other incompatible object 2018-01-26 15:52:06 -06:00
Matt Martz
e1bab1ab55 Only add terminal colors with DEBUG if stdout is a tty 2018-01-08 16:57:26 -06:00
Matt Martz
48a3d33ae4 Bump to beta 2018-01-03 09:16:51 -06:00
Matt Martz
c16ffd4ae7 Catch OSError and EOFError while reading from gzip stream 2018-01-02 18:32:03 -06:00
Matt Martz
9848481d06 Use the printer everywhere, leaving print_ to only be used within printer 2018-01-02 18:22:16 -06:00
Matt Martz
4737a69f10 Add a few additional tests, specifically around --source 2018-01-02 17:16:52 -06:00
Matt Martz
6381ba3742 Eliminate SHUTDOWN_EVENT global 2018-01-02 16:07:46 -06:00
Matt Martz
fa2e15ee08 Skipping test should be quiet 2017-12-11 09:36:03 -06:00
Matt Martz
eab354603f Don't display ERROR: 2 when argparse exits with non-0 2017-12-11 09:35:41 -06:00
Matt Martz
e80ccc4647 update README for usage changes 2017-11-23 10:30:31 -06:00
Matt Martz
5fbe593fc8 Get travis working properly again 2017-11-23 10:18:16 -06:00
Matt Martz
f70cc86222 No bare except 2017-11-23 10:16:23 -06:00
Matt Martz
5c061da8e0 Move the majority of the csv_header functionality to SpeedtestResults 2017-11-23 10:16:23 -06:00
Matt Martz
4457fe9fb8 Support csv-delimiter for csv-header 2017-11-23 10:16:17 -06:00
Matt Martz
b27f69d1ad Output a different message when only 1 server is provided 2017-11-23 10:15:48 -06:00
Matt Martz
5a9f82a20a Add additional information to machine parsable outputs 2017-11-23 10:15:46 -06:00
Matt Martz
3cb44f5630 Attempt to catch MemoryError if possible 2017-11-23 10:15:09 -06:00
Matt Martz
16054cc3bc Print errors to stderr 2017-11-23 10:15:09 -06:00
Matt Martz
d9642b2047 Always flush in py2 print_ 2017-11-23 10:15:09 -06:00
Matt Martz
f3a607feb2 Allow timeout to be a float 2017-11-23 10:15:09 -06:00
Matt Martz
6bfa5922c3 Add option to exclude servers, and allow --server and --exclude to be specified multiple times 2017-11-23 10:15:09 -06:00
Matt Martz
ca72d40033 Create a getter for Speedtest.best to raise an exception is get_best_server has not found a best server 2017-11-23 10:15:09 -06:00
Matt Martz
3ebb9734a2 Indicate speedtest-cli supports python 3.6, and ensure py3.2 has an appropriate setuptools version 2017-11-23 10:15:09 -06:00
Matt Martz
8854d82049 More and better debugging 2017-11-23 10:15:09 -06:00
Matt Martz
f2a97baf1e Revert "Test failing --source"
This reverts commit be7d7f6a1c.
2017-11-23 10:15:09 -06:00
Matt Martz
6531677346 Test failing --source 2017-11-23 10:15:09 -06:00
Matt Martz
6556be190a Switch to using matrix for travis 2017-11-23 10:15:09 -06:00
Matt Martz
2fe34ecf4e Remove debug print 2017-11-23 10:15:09 -06:00
Matt Martz
0e585cbf64 Docstrings and version bump 2017-11-23 10:15:07 -06:00
Matt Martz
2fe369fdf8 Remove SCHEME global 2017-11-23 10:14:35 -06:00
Matt Martz
b33c7533df flake8 fixes 2017-11-23 10:14:35 -06:00
Matt Martz
fe864f6dce Use vendored create_connection when socket doesn't have it, or socket.create_connection is too old 2017-11-23 10:14:35 -06:00
Matt Martz
10b3b09f02 Don't override socket.socket for binding, eliminiate globals SOURCE and USER_AGENT 2017-11-23 10:14:35 -06:00
Matt Martz
20e5d12a5c Support csv-delimiter for csv-header 2017-10-16 09:28:35 -05:00
Matt Martz
6603954e45 Bump to v1.0.6 2017-04-25 11:49:26 -05:00
Matt Martz
e982830350 Revert "Be consistent, use the shorter var"
This reverts commit 3c1c9d3179.
2017-04-25 10:52:40 -05:00
Matt Martz
2c89c53a79 Switch upload pre-allocation to true, but allow disabling 2017-04-25 10:34:20 -05:00
Matt Martz
401c469991 Do better calculations of the number of uploads per size to perform 2017-04-25 10:08:14 -05:00
Matt Martz
3c1c9d3179 Be consistent, use the shorter var 2017-04-25 10:07:34 -05:00
Matt Martz
e2f815618b Be consistent, explicitly instantiate all exceptions 2017-04-25 10:07:05 -05:00
Matt Martz
955a756c96 Ensure to specify Z for UTC in iso8601 date. Fixes #388 2017-04-24 13:32:35 -05:00
Matt Martz
ceef55488c Bump to v1.0.5 2017-04-21 14:38:57 -05:00
Matt Martz
20eeadcb0c Reorder StringIO imports again, add to_utf8 function to ensure we encode csv data properly. Fixes #385 2017-04-19 10:33:01 -05:00
Matt Martz
4aebe01c3e Bump version to 1.0.4 2017-04-12 12:19:39 -05:00
Matt Martz
1871b26b9a Flake8 fix 2017-04-12 12:18:54 -05:00
Matt Martz
824c584658 Invert logic for py3 print detection, to avoid confusion created by the future package 2017-04-12 12:18:54 -05:00
Matt Martz
9806e401e0 Prefer io over cStringIO and StringIO 2017-04-12 12:18:54 -05:00
Matt Martz
1642d0669f Handle utf-8 output encoding in py3 also. Fixes #382 2017-04-12 12:18:46 -05:00
Matt Martz
2e79fbf1dc Bump to 1.0.3 2017-03-30 19:29:40 -05:00
Matt Martz
f20e8808a8 Add link to python api docs 2017-03-24 15:31:02 -05:00
Matt Martz
3feb38d9d4 Allow skipping download or upload tests. Fixes #377 2017-03-24 15:30:52 -05:00
Matt Martz
d712f947d9 Always print using utf-8. Fixes #362 2017-03-17 16:21:01 -05:00
Matt Martz
55b3cf14a3 Allow --share to work with --simple and --json. Fixes #375 2017-03-17 16:06:48 -05:00
Matt Martz
33e498beb3 Add bytes_sent and bytes_received to the json output. Addresses #358 2017-01-18 15:03:32 -06:00
Matt Martz
068d71597b Bump to 1.0.2 2017-01-18 14:10:02 -06:00
Matt Martz
1863c35f6b alpha version bump 2017-01-09 19:49:19 -06:00
Matt Martz
823d7dc2b7 Better handling of retrieving config and server list 2017-01-09 19:48:35 -06:00
Matt Martz
411f1609e8 Don't sys.exit(1), instead either raise the exception, or a new SpeedtestCLIError. Fixes #352 2017-01-06 13:20:46 -06:00
Matt Martz
7b38e264bc Bump to 1.0.1 2016-12-22 11:35:06 -06:00
Matt Martz
2acba6ecd7 Revert "Pre create upload data, to not impact timing"
This reverts commit 6685d91729.
2016-12-12 14:08:20 -06:00
Matt Martz
53ef57bd5e Ensure we install speedtest_cli.py 2016-11-17 11:20:19 -06:00
Matt Martz
c512684ffa Don't use mutable defaults as args for methods 2016-11-11 10:00:24 -06:00
Matt Martz
6685d91729 Pre create upload data, to not impact timing 2016-11-04 16:05:57 -05:00
7 changed files with 843 additions and 290 deletions

View File

@ -1,8 +1,5 @@
language: python language: python
python:
- 2.7
addons: addons:
apt: apt:
sources: sources:
@ -11,26 +8,47 @@ addons:
- python2.4 - python2.4
- python2.5 - python2.5
- python2.6 - python2.6
- pypy - python3.2
- python3.3
env: matrix:
- TOXENV=py24 include:
- TOXENV=py25 - python: 2.7
- TOXENV=py26 env: TOXENV=flake8
- TOXENV=py27 - python: 2.7
- TOXENV=py32 env: TOXENV=py24
- TOXENV=py33 - python: 2.7
- TOXENV=py34 env: TOXENV=py25
- TOXENV=py35 - python: 2.7
- TOXENV=pypy env: TOXENV=py26
- TOXENV=flake8 - python: 2.7
env: TOXENV=py27
- python: 2.7
env: TOXENV=py32
- python: 2.7
env: TOXENV=py33
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: pypy
env: TOXENV=pypy
before_install:
- if [[ $(echo "$TOXENV" | egrep -c "py35") != 0 ]]; then pyenv global system 3.5; fi;
install: install:
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[12])") != 0 ]]; then pip install virtualenv==1.7.2 tox==1.3; fi; - if [[ $(echo "$TOXENV" | egrep -c "py32") != 0 ]]; then pip install setuptools==17.1.1; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[12])") == 0 ]]; then pip install tox; fi; - if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[12])") != 0 ]]; then pip install virtualenv==1.7.2 tox==1.3; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py26|py33)") != 0 ]]; then pip install virtualenv==15.2.0 tox==2.9.1; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py2[456]|py3[123])") == 0 ]]; then pip install tox; fi;
script: script:
- tox - tox
notifications: notifications:
email: email:

View File

@ -1,3 +1,7 @@
#Usage
$ curl -s https://git.spectre5.com/adamcruz/speedtest-cli-pub/raw/branch/master/speedtest.py | python -
speedtest-cli speedtest-cli
============= =============
@ -7,9 +11,9 @@ speedtest.net
.. image:: https://img.shields.io/pypi/v/speedtest-cli.svg .. image:: https://img.shields.io/pypi/v/speedtest-cli.svg
:target: https://pypi.python.org/pypi/speedtest-cli/ :target: https://pypi.python.org/pypi/speedtest-cli/
:alt: Latest Version :alt: Latest Version
.. image:: https://img.shields.io/pypi/dm/speedtest-cli.svg .. image:: https://img.shields.io/travis/sivel/speedtest-cli.svg
:target: https://pypi.python.org/pypi/speedtest-cli/ :target: https://pypi.python.org/pypi/speedtest-cli/
:alt: Downloads :alt: Travis
.. image:: https://img.shields.io/pypi/l/speedtest-cli.svg .. image:: https://img.shields.io/pypi/l/speedtest-cli.svg
:target: https://pypi.python.org/pypi/speedtest-cli/ :target: https://pypi.python.org/pypi/speedtest-cli/
:alt: License :alt: License
@ -17,7 +21,7 @@ speedtest.net
Versions Versions
-------- --------
speedtest-cli works with Python 2.4-3.5 speedtest-cli works with Python 2.4-3.7
.. image:: https://img.shields.io/pypi/pyversions/speedtest-cli.svg .. image:: https://img.shields.io/pypi/pyversions/speedtest-cli.svg
:target: https://pypi.python.org/pypi/speedtest-cli/ :target: https://pypi.python.org/pypi/speedtest-cli/
@ -74,10 +78,12 @@ Usage
:: ::
$ speedtest-cli -h $ speedtest-cli -h
usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--csv] usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share]
[--csv-delimiter CSV_DELIMITER] [--csv-header] [--json] [--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
[--list] [--server SERVER] [--mini MINI] [--source SOURCE] [--csv-header] [--json] [--list] [--server SERVER]
[--timeout TIMEOUT] [--secure] [--version] [--exclude EXCLUDE] [--mini MINI] [--source SOURCE]
[--timeout TIMEOUT] [--secure] [--no-pre-allocate]
[--version]
Command line interface for testing internet bandwidth using speedtest.net. Command line interface for testing internet bandwidth using speedtest.net.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
@ -85,11 +91,13 @@ Usage
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
--no-download Do not perform download test
--no-upload Do not perform upload test
--bytes Display values in bytes instead of bits. Does not --bytes Display values in bytes instead of bits. Does not
affect the image generated by --share, nor output from affect the image generated by --share, nor output from
--json or --csv --json or --csv
--share Generate and provide a URL to the speedtest.net share --share Generate and provide a URL to the speedtest.net share
results image results image, not displayed with --csv
--simple Suppress verbose output, only show basic information --simple Suppress verbose output, only show basic information
--csv Suppress verbose output, only show basic information --csv Suppress verbose output, only show basic information
in CSV format. Speeds listed in bit/s and not affected in CSV format. Speeds listed in bit/s and not affected
@ -103,14 +111,28 @@ Usage
affected by --bytes affected by --bytes
--list Display a list of speedtest.net servers sorted by --list Display a list of speedtest.net servers sorted by
distance distance
--server SERVER Specify a server ID to test against --server SERVER Specify a server ID to test against. Can be supplied
multiple times
--exclude EXCLUDE Exclude a server from selection. Can be supplied
multiple times
--mini MINI URL of the Speedtest Mini server --mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to --source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10 --timeout TIMEOUT HTTP timeout in seconds. Default 10
--secure Use HTTPS instead of HTTP when communicating with --secure Use HTTPS instead of HTTP when communicating with
speedtest.net operated servers speedtest.net operated servers
--no-pre-allocate Do not pre allocate upload data. Pre allocation is
enabled by default to improve upload performance. To
support systems with insufficient memory, use this
option to avoid a MemoryError
--version Show the version number and exit --version Show the version number and exit
Python API
----------
See the `wiki <https://github.com/sivel/speedtest-cli/wiki>`_.
Inconsistency Inconsistency
------------- -------------

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2012-2016 Matt Martz # Copyright 2012-2018 Matt Martz
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -90,5 +90,7 @@ setup(
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
] ]
) )

View File

@ -1,4 +1,4 @@
.TH "speedtest-cli" 1 "2014-04-23" "speedtest-cli" .TH "speedtest-cli" 1 "2018-01-05" "speedtest-cli"
.SH NAME .SH NAME
speedtest\-cli \- Command line interface for testing internet bandwidth using speedtest.net speedtest\-cli \- Command line interface for testing internet bandwidth using speedtest.net
.SH SYNOPSIS .SH SYNOPSIS
@ -23,14 +23,24 @@ Displays usage for the tool.
.B Options .B Options
\fB\-\-no\-download\fR
.RS
Do not perform download test
.RE
\fB\-\-no\-upload\fR
.RS
Do not perform upload test
.RE
\fB\-\-bytes\fR \fB\-\-bytes\fR
.RS .RS
Display values in bytes instead of bits. Does not affect the image generated by \-\-share Display values in bytes instead of bits. Does not affect the image generated by \-\-share, nor output from \-\-json or \-\-csv
.RE .RE
\fB\-\-share\fR \fB\-\-share\fR
.RS .RS
Generate and provide a URL to the speedtest.net share results image Generate and provide a URL to the speedtest.net share results image, not displayed with \-\-csv
.RE .RE
\fB\-\-simple\fR \fB\-\-simple\fR
@ -43,12 +53,12 @@ Suppress verbose output, only show basic information
Suppress verbose output, only show basic information in CSV format. Speeds listed in bit/s and not affected by \-\-bytes Suppress verbose output, only show basic information in CSV format. Speeds listed in bit/s and not affected by \-\-bytes
.RE .RE
\fB\-\-csv-delimiter CSV_DELIMITER\fR \fB\-\-csv\-delimiter CSV_DELIMITER\fR
.RS .RS
Single character delimiter to use in CSV output. Default "," Single character delimiter to use in CSV output. Default ","
.RE .RE
\fB\-\-csv-header\fR \fB\-\-csv\-header\fR
.RS .RS
Print CSV headers Print CSV headers
.RE .RE
@ -65,7 +75,12 @@ Display a list of speedtest.net servers sorted by distance
\fB\-\-server SERVER\fR \fB\-\-server SERVER\fR
.RS .RS
Specify a server ID to test against Specify a server ID to test against. Can be supplied multiple times
.RE
\fB\-\-exclude EXCLUDE\fR
.RS
Exclude a server from selection. Can be supplied multiple times
.RE .RE
\fB\-\-mini MINI\fR \fB\-\-mini MINI\fR
@ -88,6 +103,11 @@ HTTP timeout in seconds. Default 10
Use HTTPS instead of HTTP when communicating with speedtest.net operated servers Use HTTPS instead of HTTP when communicating with speedtest.net operated servers
.RE .RE
\fB\-\-no\-pre\-allocate\fR
.RS
Do not pre allocate upload data. Pre allocation is enabled by default to improve upload performance. To support systems with insufficient memory, use this option to avoid a MemoryError
.RE
\fB\-\-version\fR \fB\-\-version\fR
.RS .RS
Show the version number and exit Show the version number and exit

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2012-2016 Matt Martz # Copyright 2018 Matt Martz
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,20 +15,23 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import warnings import sys
import subprocess
DEPRECATED_MSG = ('The file speedtest_cli.py has been deprecated in favor of ' cmd = [sys.executable, 'speedtest.py', '--source', '127.0.0.1']
'speedtest.py\nand is available for download at:\n\n'
'https://raw.githubusercontent.com/sivel/speedtest-cli/'
'master/speedtest.py')
p = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
if __name__ == '__main__': stdout, stderr = p.communicate()
raise SystemExit(DEPRECATED_MSG)
else: if p.returncode != 1:
try: raise SystemExit('%s did not fail with exit code 1' % ' '.join(cmd))
from speedtest import *
except ImportError: if 'Invalid argument'.encode() not in stderr:
raise SystemExit(DEPRECATED_MSG) raise SystemExit(
else: '"Invalid argument" not found in stderr:\n%s' % stderr.decode()
warnings.warn(DEPRECATED_MSG, UserWarning) )

View File

@ -6,6 +6,8 @@ commands =
{envpython} -V {envpython} -V
{envpython} -m compileall speedtest.py {envpython} -m compileall speedtest.py
{envpython} speedtest.py {envpython} speedtest.py
{envpython} speedtest.py --source 172.17.0.1
{envpython} tests/scripts/source.py
[testenv:flake8] [testenv:flake8]
basepython=python basepython=python
@ -19,3 +21,5 @@ commands =
pypy -V pypy -V
pypy -m compileall speedtest.py pypy -m compileall speedtest.py
pypy speedtest.py pypy speedtest.py
pypy speedtest.py --source 172.17.0.1
pypy tests/scripts/source.py