instagrapi icon indicating copy to clipboard operation
instagrapi copied to clipboard

I can't send any DM to anyone other than myself (Max retries exceeded with url: /api/v1/direct_v2/threads/broadcast/text/ (Caused by ResponseError('too many 500 error responses')))

Open spacehitchiker opened this issue 10 months ago • 4 comments

I'm trying to send DMs but it gives error whenever I try to send DM to someone other than myself.

For example something simple as:

from instagrapi import Client

cl = Client()
cl.load_settings('session_chiyo.json')
threads = cl.direct_threads(1)
user_id = threads[0].id
cl.direct_send("hi there", [int(user_id)])

Error:


urllib3.exceptions.ResponseError: too many 500 error responses

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\urllib3\connectionpool.py", line 941, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\urllib3\connectionpool.py", line 931, in urlopen
    retries = retries.increment(method, url, response=response, _pool=self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\urllib3\util\retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='i.instagram.com', port=443): Max retries exceeded with url: /api/v1/direct_v2/threads/broadcast/text/ (Caused by ResponseError('too many 500 error responses'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Feza\Documents\pythonProject\deftry.py", line 7, in <module>
    cl.direct_send("hi there", [int(user_id)])
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\instagrapi\mixins\direct.py", line 454, in direct_send
    result = self.private_request(
             ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\instagrapi\mixins\private.py", line 542, in private_request
    raise e
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\instagrapi\mixins\private.py", line 527, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\instagrapi\mixins\private.py", line 341, in _send_private_request
    response = self.private.post(
               ^^^^^^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\requests\sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Feza\Documents\pythonProject\venv\Lib\site-packages\requests\adapters.py", line 510, in send
    raise RetryError(e, request=request)
requests.exceptions.RetryError: HTTPSConnectionPool(host='i.instagram.com', port=443): Max retries exceeded with url: /api/v1/direct_v2/threads/broadcast/text/ (Caused by ResponseError('too many 500 error responses'))

spacehitchiker avatar Oct 20 '23 14:10 spacehitchiker

@subzeroid This is an issue with this library. Unfortunately, it's tough to reproduce it because it comes randomly, in my case it comes when I run my code 8-10 times in 5-10 mins.

Will this be fixed?

xts-bit avatar Oct 25 '23 10:10 xts-bit

@subzeroid This is an issue with this library. Unfortunately, it's tough to reproduce it because it comes randomly, in my case it comes when I run my code 8-10 times in 5-10 mins.

Will this be fixed?

@xts-bit I wish I could even run my code that much without problem, I get this error all the time, do you use a proxy?

spacehitchiker avatar Oct 29 '23 12:10 spacehitchiker

@spacehitchiker No, I also get that same error @subzeroid Any fix?

xts-bit avatar Oct 30 '23 14:10 xts-bit

still happening, i can't send any dms at this point

diegoterron avatar Mar 12 '24 18:03 diegoterron