admin管理员组

文章数量:1323029

Caveat: Yes, I know that imgpurpython is not maintained, this has however worked for me quite recently.

I have a simple python3 application that uses the OAuth authorization to call into imgur's API. I mainly use it to upload small sets (4, maybe 5) of images at once, and add them all to an album.

Up until recently, the application worked quite well, and would upload the images and add them to a (hidden) album. The album just makes it easier for me to see the images grouped on the imgur posts page.

Today I was trying to do this again after several months. The application ran fine, and uploaded all 3 images, but then failed to create the album, saying

imgurpython.helpers.error.ImgurClientError: (400) Unable to decode request body

The request data for the album creation uses the correct url, it has a sane body (as prescribed by the imgur API documentation). Has imgur changed its API without updating the Documentation?

PS: I don't exceed the usage limits, and I don't upload insensitive stuff. I don't think I'm being throttled or anything, because I've re-tried the application a couple of times now, and the image uploading always works - only the album creation fails.

EDIT: Here is the request details, which I print out by modifying imgurpython right before executing the request:

method_to_call: <function post at 0x1035b42c0>
url: 
header: {
  'Authorization': 'Bearer [...]'},
  data: {
    'privacy': 'hidden', 
    'title': 'test'
  }

I know the 'privacy' entry is deprecated, but it has not been sunset yet, according to the API documentation.

This fails with the following error response:

error: {'status': 400, 'success': False, 'data': {'error': 'Unable to decode request body', 'request': '/3/album', 'method': 'POST'}}

本文标签: imgurimgurpython39s createalbum failsStack Overflow