Created
March 26, 2015 22:26
-
-
Save jag3773/f3f03f6c1bbbd4ab1b31 to your computer and use it in GitHub Desktop.
JSON Post Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> data | |
{'content': u'https://api.unfoldingword.org/obs/txt/1/es/obs-es.json?date_modified=20141208', 'sig': u'MGUCMQDnCIED/Rzt09WRBvC8ngxLNGOYaWC4dWJkGnuYwkiLYR+hvyogDlx+v+YVaFiRUvcCMGKQD3FjJpspjVJQsbfEW7z2OIOmrGRyDIWzb6TbAnCCj1Gn00JRidI3SgUomSd8eQ==', 'slug': u'uW'} | |
>>> payload = json.dumps(data) | |
>>> payload | |
'{"content": "https://api.unfoldingword.org/obs/txt/1/es/obs-es.json?date_modified=20141208", "sig": "MGUCMQDnCIED/Rzt09WRBvC8ngxLNGOYaWC4dWJkGnuYwkiLYR+hvyogDlx+v+YVaFiRUvcCMGKQD3FjJpspjVJQsbfEW7z2OIOmrGRyDIWzb6TbAnCCj1Gn00JRidI3SgUomSd8eQ==", "slug": "uW"}' | |
>>> req = urllib2.Request(api, payload, {'Content-Type': 'application/json'}) | |
>>> f = urllib2.urlopen(req) | |
>>> response = f.read() | |
>>> f.close() | |
>>> response | |
'{"error": "expected string or buffer"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment