Hi guys,
I’m facing the situation that my shotgrid desktop can NOT download user’s thumbnail image.
I found errors in log file like this:
2023-10-18 19:14:18,024 [40852 DEBUG sgtk.env.project.tk-shogunpost.tk-framework-shotgunutils] [SgCurrentUserModel] Retrieved error from data worker: Could not download contents of url ‘XXXX’. Error reported: HTTP Error 401: Unauthorized
And then , I reproduced this issue via Python API:
sg_data = sg.find('HumanUser', [['id', 'is', 1669]], ['image'])
# 'http://shotgun-xxxx.com/thumbnail/api_image/400907?AccessKeyId=uTbPnnWUNhxxnSG7Agrp&Expires=1697716228&Signature=vHmVbyeqcy17o0vhMZ9Ljo%2BxMnpTQdD%xxuwZiCYoDBtA%3D'
image_url = sg_data[0]['image']
try:
request = urllib.request.Request(image_url)
response = urllib.request.urlopen(request)
use_url_extension = True
if use_url_extension:
url_ext = os.path.splitext(urllib.parse.urlparse(response.geturl()).path)[
-1
]
if url_ext:
location = "%s%s" % (location, url_ext)
f = open(location, "wb")
try:
f.write(response.read())
finally:
f.close()
except Exception as e:
print (
"Could not download contents of url '%s'. Error reported: %s" % (image_url, e)
)
It reported the same Error: 404, Unauthorized.
I am very grateful for any suggestions or reminders from yours.