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] HTTPError: 400 Client Error: Bad Request and UnknownError: Denied in DEFCON mode #1845

Open
bladas opened this issue Mar 20, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@bladas
Copy link

bladas commented Mar 20, 2024

Describe the bug
When trying to get a list of direct threads, an error appears.

Traceback
Traceback (most recent call last):
File "/app/instagram_service/insta_wrapper.py", line 138, in _send_private_request
response.raise_for_status()
File "/usr/local/lib/python3.10/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/direct_v2/inbox/?visual_message_return_type=unseen&thread_message_limit=2&persistentBadging=true&limit=20&is_prefetching=false&fetch_reason=manual_refresh&folder=0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/instagram_service/services.py", line 142, in account_task
self.__direct_threads(
File "/app/instagram_service/services.py", line 179, in __direct_threads
threads_chunk, cursor = self.client.direct_threads_chunk(
File "/usr/local/lib/python3.10/site-packages/instagrapi/mixins/direct.py", line 151, in direct_threads_chunk
result = self.private_request("direct_v2/inbox/", params=params)
File "/app/instagram_service/insta_wrapper.py", line 71, in private_request
raise e
File "/app/instagram_service/insta_wrapper.py", line 54, in private_request
self._send_private_request(endpoint, **kwargs)
File "/app/instagram_service/insta_wrapper.py", line 227, in _send_private_request
raise UnknownError(**last_json)
instagrapi.exceptions.UnknownError: Denied in DEFCON mode

Desktop (please complete the following information):

  • OS: [e.g. Ubuntu 21.04]
  • Python version [e.g. 3.10]
  • instagrapi version [e.g. 2.1.1]
@bladas bladas added the bug Something isn't working label Mar 20, 2024
@RihardsKluinis
Copy link

Same bug for me

@vltclz
Copy link
Contributor

vltclz commented Mar 20, 2024

Same also here, after some research it seems like DEFCON is a hacker convention
I hope there's no hacking involved here 😅

@vltclz
Copy link
Contributor

vltclz commented Mar 20, 2024

I tried playing around to see what would fix this and - even though I have no idea why - the removal of the param "fetch_reason": "cold_start" fixes this. PR created

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