This commit is contained in:
Gal Golan 2016-09-05 00:29:14 +00:00 committed by GitHub
commit 70e08aab17
2 changed files with 8 additions and 14 deletions

View File

@ -25,8 +25,8 @@ env:
- TOXENV=flake8
install:
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py31)") != 0 ]]; then pip install virtualenv==1.7.2 tox==1.3; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py31)") == 0 ]]; then pip install tox; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py31)") != 0 ]]; then pip install virtualenv==1.7.2 tox==1.3 requests; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py31)") == 0 ]]; then pip install tox requests; fi;
script:
- tox

View File

@ -21,6 +21,7 @@ import sys
import math
import signal
import socket
import requests
import timeit
import platform
import threading
@ -375,19 +376,12 @@ def getConfig():
we are interested in
"""
request = build_request('://www.speedtest.net/speedtest-config.php')
uh, e = catch_request(request)
if e:
print_('Could not retrieve speedtest.net configuration: %s' % e)
sys.exit(1)
configxml = []
while 1:
configxml.append(uh.read(10240))
if len(configxml[-1]) == 0:
break
if int(uh.code) != 200:
uh = requests.get('http://www.speedtest.net/speedtest-config.php', headers = {'user-agent':user_agent})
configxml = uh.text
if(int(uh.status_code) != 200):
return None
uh.close()
try:
try:
root = ET.fromstring(''.encode().join(configxml))