Created
February 5, 2015 09:14
-
-
Save xiaodongliang/cd1d6b69feb417e9e2fe to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| url = BASE_URL + 'viewingservice/v1/thumbnails' | |
| url = url + '/' + urn | |
| headers = { | |
| 'Authorization' : 'Bearer ' + access_token | |
| } | |
| print url | |
| print headers | |
| #execute the http request | |
| r = requests.get(url,headers=headers,stream=True) | |
| if r.status_code == 200: | |
| with open("c:\\temp\\mythumnail.png", 'wb') as f: | |
| for chunk in r.iter_content(): | |
| f.write(chunk) | |
| if verbose or 200 != r.status_code: | |
| print r.status_code | |
| print r.headers['content-type'] | |
| print r.content | |
| if 200 != r.status_code: | |
| print "Get thumnail returned status code %s." % r.status_code | |
| raise SystemExit(9) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment