subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.06k stars 652 forks source link

[BUG] HTTPError: 400 Client Error: Bad Request and UnknownError: Denied in DEFCON mode #1845

Open bladas opened 4 months ago

bladas commented 4 months ago

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):

RihardsKluinis commented 4 months ago

Same bug for me

vltclz commented 4 months ago

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

vltclz commented 4 months ago

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