Beispiel #1
0
 def header(self):
     b64 = b64encode(('%s:%s' % (
         self.username, self.password)).encode(DEFAULT_CHARSET))
     return 'Basic %s' % native_str(b64.strip(), DEFAULT_CHARSET)
Beispiel #2
0
 def challenge_response(self, key):
     sha1 = hashlib.sha1(to_bytes(key+WEBSOCKET_GUID))
     return native_str(base64.b64encode(sha1.digest()))
Beispiel #3
0
 def test_native_str(self):
     s = 'ciao'
     s2 = httpurl.native_str(s)
     self.assertEqual(id(s), id(s2))