Mercurial > public > mercurial-scm > hg
comparison mercurial/keepalive.py @ 6470:ac0bcd951c2c
python 2.6 compatibility: compatibility wrappers for hash functions
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Fri, 04 Apr 2008 22:36:40 +0200 |
parents | 30d2fecaab76 |
children | 4dd7b28003d2 |
comparison
equal
deleted
inserted
replaced
6469:fb502719c75c | 6470:ac0bcd951c2c |
---|---|
17 # This file is part of urlgrabber, a high-level cross-protocol url-grabber | 17 # This file is part of urlgrabber, a high-level cross-protocol url-grabber |
18 # Copyright 2002-2004 Michael D. Stenner, Ryan Tomayko | 18 # Copyright 2002-2004 Michael D. Stenner, Ryan Tomayko |
19 | 19 |
20 # Modified by Benoit Boissinot: | 20 # Modified by Benoit Boissinot: |
21 # - fix for digest auth (inspired from urllib2.py @ Python v2.4) | 21 # - fix for digest auth (inspired from urllib2.py @ Python v2.4) |
22 # Modified by Dirkjan Ochtman: | |
23 # - import md5 function from a local util module | |
22 | 24 |
23 """An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive. | 25 """An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive. |
24 | 26 |
25 >>> import urllib2 | 27 >>> import urllib2 |
26 >>> from keepalive import HTTPHandler | 28 >>> from keepalive import HTTPHandler |
448 hosts = keepalive_handler.open_connections() | 450 hosts = keepalive_handler.open_connections() |
449 print "open connections:", hosts | 451 print "open connections:", hosts |
450 keepalive_handler.close_all() | 452 keepalive_handler.close_all() |
451 | 453 |
452 def continuity(url): | 454 def continuity(url): |
453 import md5 | 455 from util import md5 |
454 format = '%25s: %s' | 456 format = '%25s: %s' |
455 | 457 |
456 # first fetch the file with the normal http handler | 458 # first fetch the file with the normal http handler |
457 opener = urllib2.build_opener() | 459 opener = urllib2.build_opener() |
458 urllib2.install_opener(opener) | 460 urllib2.install_opener(opener) |