/venus

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/venus/

« back to all changes in this revision

Viewing changes to planet/vendor/httplib2/__init__.py

  • Committer: Jacques Distler
  • Date: 2009-01-05 02:55:13 UTC
  • Revision ID: distler@golem.ph.utexas.edu-20090105025513-djk2unyyct87mn9x
Use hashlib instead of md5
  
Python 2.6 complains about md5.
Hashlib works for  python >= 2.5.

Show diffs side-by-side

added added

removed removed

23
23
 
24
24
import re 
25
25
import sys 
26
 
import md5
 
26
import hashlib
27
27
import email
28
28
import email.Utils
29
29
import email.Message
163
163
        pass
164
164
    if isinstance(filename,unicode):
165
165
        filename=filename.encode('utf-8')
166
 
    filemd5 = md5.new(filename).hexdigest()
 
166
    filemd5 = hashlib.md5(filename).hexdigest()
167
167
    filename = re_url_scheme.sub("", filename)
168
168
    filename = re_slash.sub(",", filename)
169
169
 
339
339
            cache.set(cachekey, text)
340
340
 
341
341
def _cnonce():
342
 
    dig = md5.new("%s:%s" % (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])).hexdigest()
 
342
    dig = hashlib.md5("%s:%s" % (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])).hexdigest()
343
343
    return dig[:16]
344
344
 
345
345
def _wsse_username_token(cnonce, iso_now, password):
417
417
 
418
418
    def request(self, method, request_uri, headers, content, cnonce = None):
419
419
        """Modify the request headers"""
420
 
        H = lambda x: md5.new(x).hexdigest()
 
420
        H = lambda x: hashlib.md5(x).hexdigest()
421
421
        KD = lambda s, d: H("%s:%s" % (s, d))
422
422
        A2 = "".join([method, ":", request_uri])
423
423
        self.challenge['cnonce'] = cnonce or _cnonce()