Forum Discussion
DFDK
3 years agoQrew Member
DougHenning1
3 years agoCommunity Manager
Is the file you're downloading JSON? If not then you'll get an error with those JSON commands. You can access the body of the response with "r.content" or "r.text" depending on the file type.
r = requests.get(
request_str,
headers = headers
)
print(r.content)
------------------------------
Doug Henning
------------------------------
r = requests.get(
request_str,
headers = headers
)
print(r.content)
------------------------------
Doug Henning
------------------------------
- DFDK3 years agoQrew Member
- DFDK3 years agoQrew Member
- NaftaliKulik3 years agoQrew MemberDid you ever solve this? I'm running into the same issue
------------------------------
Naftali Kulik
------------------------------- DFDK3 years agoQrew MemberYes. In the end this works for me.
#Get image url using your method of choice
import urllib.request
from PIL import Image
from io import BytesIO
url = urllib.request.urlopen('https://the_image_url?usertoken=' + quickbase_token)
s = url.read()
img = Image.open(BytesIO(s))
img.show() #or do whatever you want with it