home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / atom / auth.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.0 KB  |  19 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __author__ = 'j.s@google.com (Jeff Scudder)'
  5. import base64
  6.  
  7. class BasicAuth(object):
  8.     '''Sets the Authorization header as defined in RFC1945'''
  9.     
  10.     def __init__(self, user_id, password):
  11.         self.basic_cookie = base64.encodestring('%s:%s' % (user_id, password)).strip()
  12.  
  13.     
  14.     def modify_request(self, http_request):
  15.         http_request.headers['Authorization'] = 'Basic %s' % self.basic_cookie
  16.  
  17.     ModifyRequest = modify_request
  18.  
  19.