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 Bad request error when try to login and then instagrapi calls https://i.instagram.com/api/v1/feed/reels_tray/ #1866

Open
ATOM27 opened this issue Apr 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ATOM27
Copy link

ATOM27 commented Apr 7, 2024

Try Instagrapi SaaS with a free trial https://hikerapi.com/p/5GBWznd3

Describe the bug
A clear and concise description of what the bug is.
I have an 400 Bad request error when try to login and then instagrapi calls https://i.instagram.com/api/v1/feed/reels_tray/ and I get

File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 359, in _send_private_request
  response.raise_for_status()
File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/requests/models.py", line 1021, 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/eugene_mekhedov/TelegramBot/hello.py", line 141, in <module>
  start()
File "/home/eugene_mekhedov/TelegramBot/hello.py", line 135, in start
  instagram.login()
File "/home/eugene_mekhedov/TelegramBot/InstagramEditor.py", line 14, in login
  instClient.login("****", "*******", relogin=True)
File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/auth.py", line 472, in login
  self.login_flow()
File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/auth.py", line 186, in login_flow
  check_flow.append(self.get_reels_tray_feed("cold_start"))
File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/auth.py", line 277, in get_reels_tray_feed
  return self.private_request("feed/reels_tray/", data)
File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 541, in private_request
  raise e
File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 526, in private_request
  self._send_private_request(endpoint, **kwargs)
File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 448, in _send_private_request
  raise UnknownError(**last_json)
instagrapi.exceptions.UnknownError: consent_required

To Reproduce
Provide a piece of code to reproduce the problem.
just call login method.

Traceback
Show your full traceback so that it is clear where exactly the error occurred.

File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 359, in _send_private_request
   response.raise_for_status()
 File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/requests/models.py", line 1021, 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/eugene_mekhedov/TelegramBot/hello.py", line 141, in <module>
   start()
 File "/home/eugene_mekhedov/TelegramBot/hello.py", line 135, in start
   instagram.login()
 File "/home/eugene_mekhedov/TelegramBot/InstagramEditor.py", line 14, in login
   instClient.login("****", "*****", relogin=True)
 File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/auth.py", line 472, in login
   self.login_flow()
 File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/auth.py", line 186, in login_flow
   check_flow.append(self.get_reels_tray_feed("cold_start"))
 File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/auth.py", line 277, in get_reels_tray_feed
   return self.private_request("feed/reels_tray/", data)
 File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 541, in private_request
   raise e
 File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 526, in private_request
   self._send_private_request(endpoint, **kwargs)
 File "/home/eugene_mekhedov/.local/lib/python3.9/site-packages/instagrapi/mixins/private.py", line 448, in _send_private_request
   raise UnknownError(**last_json)
instagrapi.exceptions.UnknownError: consent_required

Expected behavior
A clear and concise description of what you expected to happen.
I expect to login without error

Desktop (please complete the following information):

  • OS: Ubuntu
  • Python version 3.9
  • instagrapi version 2.1.1
  • moveipy 6.0.2

Additional context
Add any other context about the problem here.
Interesting thing that if I run my code on my mac it works fine, but when I try to launch it on google's cloud I get this error

@ATOM27 ATOM27 added the bug Something isn't working label Apr 7, 2024
@ATOM27 ATOM27 changed the title [BUG] [BUG] 400 Bad request error when try to login and then instagrapi calls https://i.instagram.com/api/v1/feed/reels_tray/ Apr 7, 2024
@tajbowness
Copy link
Contributor

I think you've included your password in the traceback.

Last line instagrapi.exceptions.UnknownError: consent_required
Hints that you may have 2FA?

@ATOM27
Copy link
Author

ATOM27 commented Apr 8, 2024

@tajbowness Thank you)
No, I don't have 2FA

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

2 participants