Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/feed/reels_tray/ #783

Open
GildedHonour opened this issue Jul 15, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@GildedHonour
Copy link

GildedHonour commented Jul 15, 2022

The example from README

pip install instagrapi

-->

from instagrapi import Client

ACCOUNT_USERNAME = "[email protected]"
ACCOUNT_PASSWORD = "lML0XLLAoWkxMMWvBtQU"

cl = Client()
cl.login(ACCOUNT_USERNAME, ACCOUNT_PASSWORD)

user_id = cl.user_id_from_username("adw0rd")
medias = cl.user_medias(user_id, 20)

===>

% python test1.py

Enter code (6 digits) for [email protected] (ChallengeChoice.EMAIL): 353703
Code entered "353703" for [email protected] (0 attempts by 5 seconds)
Enter password for [email protected]: lML0XLLAoWkxMMWvBtQU
Password entered "lML0XLLAoWkxMMWvBtQU" for [email protected] (0 attempts by 5 seconds)
Traceback (most recent call last):
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
    response.raise_for_status()
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/feed/reels_tray/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 432, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 330, in _send_private_request
    raise ChallengeRequired(**last_json)
instagrapi.exceptions.ChallengeRequired: challenge_required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
    response.raise_for_status()
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://i.instagram.com/api/v1/bloks/apps/com.instagram.challenge.navigation.take_challenge/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/instag_api1.py", line 7, in <module>
    cl.login(ACCOUNT_USERNAME, ACCOUNT_PASSWORD)
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/auth.py", line 418, in login
    self.login_flow()
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/auth.py", line 167, in login_flow
    check_flow.append(self.get_reels_tray_feed("cold_start"))
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/auth.py", line 244, in get_reels_tray_feed
    return self.private_request("feed/reels_tray/", data)
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 443, in private_request
    self.challenge_resolve(self.last_json)
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/challenge.py", line 78, in challenge_resolve
    return self.challenge_resolve_simple(challenge_url)
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/challenge.py", line 421, in challenge_resolve_simple
    return self.bloks_change_password(pwd, self.last_json['challenge_context'])
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/bloks.py", line 46, in bloks_change_password
    return self.bloks_action("com.instagram.challenge.navigation.take_challenge", data)
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/bloks.py", line 21, in bloks_action
    result = self.private_request(f"bloks/apps/{action}/", self.with_default_data(data))
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 445, in private_request
    raise e
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 432, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/home/user1/.local/lib/python3.10/site-packages/instagrapi/mixins/private.py", line 317, in _send_private_request
    self.last_json = last_json = response.json()
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] Oops, an error occurred.
: 0
@GildedHonour GildedHonour added the bug Something isn't working label Jul 15, 2022
@EricMyhrer
Copy link

You ever get a fix on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants