instagram_private_api_extensions icon indicating copy to clipboard operation
instagram_private_api_extensions copied to clipboard

Bad Request Error

Open Lem0nTree opened this issue 5 years ago • 5 comments

Before submitting an issue make sure you have:

  • [X] Updated to the lastest version v0.3.8
  • [X] Read the README
  • [X] Searched the bugtracker for similar issues including closed ones

Describe the Bug/Error:

Bad request error 400


Paste the output of python -V here:

Code: 3.7.5

# Example code that will produce the error reported

# post a photo
photo_data, photo_size = media.prepare_image(
    'test/test.jpg', aspect_ratios=MediaRatios.standard)
api.post_photo(photo_data, photo_size, caption='Hello World!')

Error/Debug Log:

python .\test.py
C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\site-packages\instagram_private_api\endpoints\upload.py:397: UserWarning: This endpoint has not been fully tested.
  warnings.warn('This endpoint has not been fully tested.', UserWarning)
Error parsing error response: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\site-packages\instagram_private_api\endpoints\upload.py", line 446, in post_photo
    response = self.opener.open(req, timeout=self.timeout)
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".\test.py", line 10, in <module>
    api.post_photo(photo_data, photo_size, caption='Hello World!')
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\site-packages\instagram_private_api\endpoints\upload.py", line 450, in post_photo
    ErrorHandler.process(e, error_response)
  File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\site-packages\instagram_private_api\errors.py", line 135, in process
    raise ClientError(error_msg, http_error.code, error_response)
instagram_private_api.errors.ClientError: Bad Request
PS C:\Users\loren\Desktop\tiktok\instagram api\instagram_private_api_extensions-master\tests>

Lem0nTree avatar Nov 01 '19 22:11 Lem0nTree

Same Error. Any fix?

NU11B0T avatar Dec 02 '19 18:12 NU11B0T

Same Error too, hope the answer

jerryan9999 avatar Apr 01 '20 11:04 jerryan9999

Yep, I got the same error, it might be about Instagram's new API changes.

Edit: for anyone who is having a hard time as myself, I recommend to take a look at this API, it works for me.

burraksumer avatar Apr 30 '20 21:04 burraksumer

Yep, I got the same error, it might be about Instagram's new API changes.

Edit: for anyone who is having a hard time as myself, I recommend to take a look at this API, it works for me.

Thank you! Not just working like a charm but it has plenty of functions and examples, and its pretty up-to-date!

megada-lab avatar Jun 02 '20 15:06 megada-lab

Any news?

Buckler89 avatar Jul 17 '22 10:07 Buckler89