-
-
Save rgbkrk/7645240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import hashlib | |
import time | |
try: | |
from urllib.request import urlopen | |
except ImportError: | |
from urllib import urlopen | |
url = ('https://pypi.python.org/packages/source/v/virtualenv/' + | |
'virtualenv-1.10.1.tar.gz') | |
md5sum_expected = '3a04aa2b32c76c83725ed4d9918e362e' | |
def trial(debugger=None): | |
''' | |
Trial runs through an example that fails on some boxes | |
debugger should be pdb or ipdb | |
''' | |
response = urlopen(url) | |
if(debugger): | |
debugger.set_trace() | |
socket = getattr(response.fp, 'raw', response.fp)._sock | |
socket.suppress_ragged_eofs = False | |
data = b'' | |
while True: | |
chunk = socket.recv(8192) | |
time.sleep(.1) | |
#print("%d %d" % (len(chunk), len(data) + len(chunk))) | |
if not chunk: | |
break | |
data += chunk | |
md5sum_actual = hashlib.md5(data).hexdigest() | |
filename = 'r%d' % time.time() | |
if md5sum_actual == md5sum_expected: | |
#print("OK") | |
#open(filename + '.ok', 'wb').write(data) | |
pass | |
else: | |
print("BAD: %s" % md5sum_actual) | |
open(filename + '.bad', 'wb').write(data) | |
print("downloaded %d bytes" % len(data)) | |
raise Exception("wat") | |
if __name__ == "__main__": | |
trial() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS C:\Users\Administrator\Documents> TRACERT.EXE pypi.python.org | |
Tracing route to global-ssl.fastly.net [199.27.74.184] | |
over a maximum of 30 hops: | |
1 <1 ms <1 ms <1 ms 162.209.124.3 | |
2 1 ms <1 ms <1 ms core8-aggr403b-8.iad3.rackspace.net [69.20.1.226] | |
3 1 ms <1 ms <1 ms corea-core5.iad2.rackspace.net [69.20.2.98] | |
4 1 ms 1 ms <1 ms corea-edge7.edge7.iad3.rackspace.net [69.20.1.241] | |
5 1 ms <1 ms <1 ms 23.30.206.229 | |
6 4 ms 3 ms 4 ms he-2-10-0-0-cr01.ashburn.va.ibone.comcast.net [68.86.83.85] | |
7 16 ms 15 ms 15 ms he-4-7-0-0-cr01.56marietta.ga.ibone.comcast.net [68.86.89.166] | |
8 37 ms 35 ms 35 ms pos-1-2-0-0-cr01.56marietta.ga.ibone.comcast.net [68.86.87.234] | |
9 34 ms 34 ms 34 ms be-11-pe02.1950stemmons.tx.ibone.comcast.net [68.86.82.134] | |
10 33 ms 33 ms 32 ms 199.27.74.1 | |
11 34 ms 33 ms 33 ms 199.27.74.184 | |
Trace complete. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment