One way is to use the unquote() function in the urllib() to first decode it:
if picture: picture = urllib.unquote(picture)
Then when you use urlencode data again, you can have some piece of mind that the code will be posted correctly. One way is to grab the ID returned by the POST call, and then JSON-decoding the response to verify that the dictionary has the 'picture' keyword:
response = urllib.urlopen("http://graph.facebook.com/%s" % id).read() json_data = json.loads(response) self.assertTrue(json_data.has_key('picture'))
The issue is similar (not sure if it's related) to the bug reported at: http://bugs.developers.facebook.net/show_bug.cgi?id=11970
No comments:
Post a Comment