Couple of minor patches

This commit is contained in:
Miroslav Stampar
2021-05-24 13:12:18 +02:00
parent dccc837703
commit da86486cd9
8 changed files with 18 additions and 14 deletions

View File

@@ -517,7 +517,7 @@ def error_handler(url):
keepalive_handler.close_all()
def continuity(url):
import md5
from hashlib import md5
format = '%25s: %s'
# first fetch the file with the normal http handler
@@ -526,7 +526,7 @@ def continuity(url):
fo = _urllib.request.urlopen(url)
foo = fo.read()
fo.close()
m = md5.new(foo)
m = md5(foo)
print(format % ('normal urllib', m.hexdigest()))
# now install the keepalive handler and try again
@@ -536,7 +536,7 @@ def continuity(url):
fo = _urllib.request.urlopen(url)
foo = fo.read()
fo.close()
m = md5.new(foo)
m = md5(foo)
print(format % ('keepalive read', m.hexdigest()))
fo = _urllib.request.urlopen(url)
@@ -546,7 +546,7 @@ def continuity(url):
if f: foo = foo + f
else: break
fo.close()
m = md5.new(foo)
m = md5(foo)
print(format % ('keepalive readline', m.hexdigest()))
def comp(N, url):