Skip to content

Instantly share code, notes, and snippets.

@edvakf
Created September 13, 2009 16:03
Show Gist options
  • Save edvakf/186221 to your computer and use it in GitHub Desktop.
Save edvakf/186221 to your computer and use it in GitHub Desktop.
--- pyhatebu/pyhatebu.py_orig 2007-04-08 07:47:24.000000000 -0400
+++ pyhatebu/pyhatebu.py 2009-09-13 11:23:58.000000000 -0400
@@ -77,7 +77,7 @@
"""
Make HatebuItem instance from response
"""
- e = ElementTree.fromstring(src)
+ e = ElementTree.fromstring(src.strip())
d = {'subject':[]}
for elem in e.getiterator():
# loop over elements
@@ -96,7 +96,10 @@
d['author'] = ''.join([x.text for x in elem.getiterator()
if x.tag.endswith('name') ])
elif t.endswith('}issued'):
- d['issued'] = make_datetime(elem.text)
+ if elem.text == None:
+ d['issued'] = datetime.datetime.now()
+ else:
+ d['issued'] = make_datetime(elem.text)
elif t.endswith('}id'):
d['id'] = elem.text
elif t.endswith('}summary'):
=======================================================================
--- pyhatebu/wsseauth.py_orig 2007-04-08 07:47:24.000000000 -0400
+++ pyhatebu/wsseauth.py 2009-09-13 11:04:30.000000000 -0400
@@ -28,7 +28,7 @@
import random
import base64
import datetime
-import sha
+import hashlib
class HTTPErrorProcessorCustom(urllib2.HTTPErrorProcessor):
"""
@@ -105,7 +105,7 @@
created = WSSEAuthRequest.dt.now().isoformat()+'Z'
passwd = self.password
#Make digest
- d = sha.new(nonce_str+created+passwd)
+ d = hashlib.sha1(nonce_str+created+passwd)
digeststr = base64.encodestring(d.digest()).replace('\n', '')
#Make header string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment