API help on expanding related image data
bobgott
Registered Users Posts: 3 Big grins
Hi Folks,
I'm trying to do some analysis via python and the SmugMug API. My scripts are running but as I do need the date/time that a photo was created that requires me to utilize the ImageMetadata. Right now I'm making 1 call to download all image data for an album (not the images themselves) then I need to make another call per image to get the DateTimeCreated from ImageMetadata. Obviously this is S.L.O.W.
Utilizing the API _expand function, I've tested the following url against the Live API browser and it seems to work:
... api.smugmug.com/api/v2/album/zc5wwB!images?_expand=ImageMetadata
but when I use the same url in my python program (via GET method) I get a 401 respnse error:
response: 401
Message: oauth_problem=signature_invalid
debug_sbs=GET&https%3A%2F%2Fapi.smugmug.com%2Fapi%2Fv2%2Falbum%2FXnch6w%21images&_expand%3DImageMetadata%26max_album_count%3D100%26oauth_consumer_key%3Dxxxxxxxx%26oauth_nonce%3Dxxxxx478fab46dxxxxxxx%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1566203136%26oauth_token%3Dr85SfV25sJ2NF9xxxxx%26oauth_version%3D1.0%26start%3D1
Can you let me know what I am doing wrong with the _expand function?
I'm trying to do some analysis via python and the SmugMug API. My scripts are running but as I do need the date/time that a photo was created that requires me to utilize the ImageMetadata. Right now I'm making 1 call to download all image data for an album (not the images themselves) then I need to make another call per image to get the DateTimeCreated from ImageMetadata. Obviously this is S.L.O.W.
Utilizing the API _expand function, I've tested the following url against the Live API browser and it seems to work:
... api.smugmug.com/api/v2/album/zc5wwB!images?_expand=ImageMetadata
but when I use the same url in my python program (via GET method) I get a 401 respnse error:
response: 401
Message: oauth_problem=signature_invalid
debug_sbs=GET&https%3A%2F%2Fapi.smugmug.com%2Fapi%2Fv2%2Falbum%2FXnch6w%21images&_expand%3DImageMetadata%26max_album_count%3D100%26oauth_consumer_key%3Dxxxxxxxx%26oauth_nonce%3Dxxxxx478fab46dxxxxxxx%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1566203136%26oauth_token%3Dr85SfV25sJ2NF9xxxxx%26oauth_version%3D1.0%26start%3D1
Can you let me know what I am doing wrong with the _expand function?
0
Comments
I'm not sure how this would result in an invalid signature, but based upon the "debug_sbs" reported, you're putting "&" before _expand instead of "?"
response = self.request('GET', url=url, params=params, headers={'Accept': 'application/json'})