Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dac510f
Replace submodule by requirements file
davidfischer-ch May 23, 2014
a576760
Fix most of the PEP-8 warnings
davidfischer-ch May 23, 2014
fb0113d
Convert to new style class
davidfischer-ch May 23, 2014
fed5a1f
Rename methods to follow recommendations of PEP-8
davidfischer-ch May 23, 2014
dff3421
Use single quotes for string literals, personal taste
davidfischer-ch May 23, 2014
97bc789
Use store_true to avoid trick with True & False
davidfischer-ch May 23, 2014
51078f2
Revert "Replace submodule by requirements file"
davidfischer-ch May 23, 2014
103eb49
Fix renaming of methods
davidfischer-ch May 23, 2014
dd37bd3
Split source + other things
davidfischer-ch May 23, 2014
0903093
Add a logging class (not yet using stdlib.logging because of \n)
davidfischer-ch May 23, 2014
b66c975
Cleanup usage of "constants"
davidfischer-ch May 23, 2014
02b75d0
Rename attributes & variables to follow recommendations of PEP-8
davidfischer-ch May 23, 2014
9666ac2
Fix renaming of attributes and variables
davidfischer-ch May 23, 2014
bd3af24
Use xrange instead of range
davidfischer-ch May 23, 2014
8516b76
Make code shorter
davidfischer-ch May 23, 2014
8baed79
Convert comments to docstrings + simplify code
davidfischer-ch May 23, 2014
2e631c2
Various cleanups & improvements
davidfischer-ch May 24, 2014
8c570e9
Use a += b instead of a = a + b
davidfischer-ch May 24, 2014
aa010fb
Rename speed_conversion to convert_size
davidfischer-ch May 24, 2014
881d55b
Load methods actually update attributes of the instance
davidfischer-ch May 24, 2014
6390101
Fix wording + use underscores
davidfischer-ch May 24, 2014
d4a51b4
Make this project a package with setup.py and make it available as a …
davidfischer-ch May 24, 2014
a9c3bfb
Update README
davidfischer-ch May 24, 2014
f778274
Use enumerate, load config & server list on access
davidfischer-ch May 25, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
old/
build/
dist/
*.egg*
*~
~
*.pyc
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

123 changes: 0 additions & 123 deletions README

This file was deleted.

105 changes: 105 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
============================
Tespeed (terminal speedtest)
============================

:copyright: Copyright 2012 Janis Jansons (janis.jansons@janhouse.lv)

This is a new TeSpeed version written in Python (for the purpose of learning it).

The old one was written in PHP years ago and wasn't really made for general public (was fine tuned and possibly working
only on my server).

Even though the old version didn't work on most boxes, it somehow got almost 17'000 downloads on Sourceforge.
I guess some people could use this (those who hate Flash, JavaScript, has GUI-less servers, etc.) so I'll try to make
this one a bit better working in time.

Let's call this version 0.1.0-alpha

Of course, this script could not work like this without the best speed testing site out there - http://www.speedtest.net/

Support them in any way you can (going to their website and clicking on ads could probably make them a bit happier). :)

------------
Installation
------------

When doing the checkout, remember to pull submodules.

If you have a decent git version (1.6.5 and up), get everything by doing::

git clone --recursive git://github.com/Janhouse/tespeed.git

Otherwise do::

git clone git://github.com/Janhouse/tespeed.git
cd tespeed
git submodule init
git submodule update

Then install it thanks to the project's setup script::

sudo ./setup.py install

-----
Usage
-----

::

usage: tespeed [-h] [-ls [LIST_SERVERS]] [-w] [-s] [-mib] [-n [SERVER_COUNT]]
[-p [USE_PROXY]] [-ph [PROXY_HOST]] [-pp [PROXY_PORT]]
[-cs [CHUNK_SIZE]]
[server]

TeSpeed, CLI SpeedTest.net

positional arguments:
server Use the specified server for testing (skip checking
for location and closest server).

optional arguments:
-h, --help show this help message and exit
-ls [LIST_SERVERS], --list-servers [LIST_SERVERS]
List the servers sorted by distance, nearest first.
Optionally specify number of servers to show.
-w, --csv Print CSV formated output to STDOUT.
-s, --suppress Suppress debugging (STDERR) output.
-mib, --mebibit Show results in mebibits.
-n [SERVER_COUNT], --server-count [SERVER_COUNT]
Specify how many different servers should be used in
parallel. (Default: 1) (Increase it for >100Mbit
testing.)
-p [USE_PROXY], --proxy [USE_PROXY]
Specify 4 or 5 to use SOCKS4 or SOCKS5 proxy.
-ph [PROXY_HOST], --proxy-host [PROXY_HOST]
Specify socks proxy host. (Default: 127.0.0.1)
-pp [PROXY_PORT], --proxy-port [PROXY_PORT]
Specify socks proxy port. (Default: 9050)
-cs [CHUNK_SIZE], --chunk-size [CHUNK_SIZE]
Specify chunk size after which tespeed calculates
speed. Increase this number 4 or 5 times if you use
weak hardware like RaspberryPi. (Default: 10240)

What the script does:

* Loads configuration from speedtest.net (http://speedtest.net/speedtest-config.php).
* Gets server list (http://speedtest.net/speedtest-servers.php).
* Picks 5 closest servers using the coordinates provides by speedtest.net config and serverlist.
* Checks latency for those servers and picks one with the lowest.
* Does download speed test and returns results.
* Does upload speed test and returns results.
* Optionally can return CSV formated results.
* Can measure through SOCKS proxy.

TODO (ideas):

* Add more error checking.
* Make it less messy.
* Send found results to speedtest.net API (needs some hash?) and get the link to the generated image.
* Store the measurement data and draw graphs.
* Measure the speed for the whole network interface (similar like it was in the old version of Tespeed).
* Start upload timer only after 1st byte is read.
* Figure out the amount of data that was transfered only when all threads were actively sending/receiving data at the
same time. (Should provide more precise test results.)


1 change: 0 additions & 1 deletion SocksiPy
Submodule SocksiPy deleted from 842d49
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
argparse
lxml
-e git://github.com/Anorov/PySocks.git#egg=PySocks
File renamed without changes.
60 changes: 60 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright:
# 2012-2013 Janis Jansons (janis.jansons@janhouse.lv)
# 2014 David Fischer (david.fischer.ch@gmail.com)

from __future__ import absolute_import, division, print_function, unicode_literals

import sys
from codecs import open
from pip.req import parse_requirements
from setuptools import setup, find_packages

# https://pypi.python.org/pypi?%3Aaction=list_classifiers

classifiers = """
Development Status :: 3 - Alpha
Environment :: Console
Intended Audience :: Developers
Intended Audience :: End Users/Desktop
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: Implementation :: CPython
Topic :: Internet :: WWW/HTTP
Topic :: Utilities
"""

not_yet_tested = """
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Operating System :: MacOS :: MacOS X
Operating System :: Unix
"""

setup(name='tespeed',
version='0.1.0-alpha',
packages=find_packages(include=['tespeed']),
description='TeSpeed, CLI SpeedTest.net',
long_description=open('README.rst', 'r', encoding='utf-8').read(),
author='Janis Jansons & David Fischer',
author_email='janis.jansons@janhouse.lv',
url='https://github.com/davidfischer-ch/tespeed',
license='MIT',
classifiers=filter(None, classifiers.split('\n')),
keywords=['benchmark', 'download', 'upload', 'network', 'speed', 'internet', 'speedtest.net'],
dependency_links=[str(requirement.url) for requirement in parse_requirements('requirements.txt')],
install_requires=[str(requirement.req) for requirement in parse_requirements('requirements.txt')],
entry_points={
'console_scripts': [
'tespeed=tespeed.bin:tespeed'
]
},
use_2to3=sys.version_info[0] > 2)
Loading