ping / instagram_private_api

A Python library to access Instagram's private API.
MIT License
2.95k stars 612 forks source link

Proxy usage example. #367

Closed Arsi44 closed 2 years ago

Arsi44 commented 2 years ago

Please follow the guide below


Before submitting an issue, make sure you have:

Which client are you using?


Describe your Question/Issue:

I-ve got problems with proxy usage. In more detail I-ve got this error (below). I have login and password from my proxy but where should I use it?


Paste the output of python -V here: Python 3.8.9

Code:

from instagram_private_api import Client, ClientCompatPatch

user_name = 'username'
password = 'pwd'

api = Client(user_name, password, proxy='http://11.11.1.111:2222/')

Error/Debug Log:

Traceback (most recent call last):
  File "C:\Users\Ars44\AppData\Local\Programs\Python\Python38\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-8912ef3d532b>", line 1, in <module>
    api = Client(user_name, password, proxy='http://45.86.3.206:7970/')
  File "C:\Users\Ars44\AppData\Local\Programs\Python\Python38\lib\site-packages\instagram_private_api\client.py", line 208, in __init__
    self.login()
  File "C:\Users\Ars44\AppData\Local\Programs\Python\Python38\lib\site-packages\instagram_private_api\endpoints\accounts.py", line 27, in login
    prelogin_params = self._call_api(
  File "C:\Users\Ars44\AppData\Local\Programs\Python\Python38\lib\site-packages\instagram_private_api\client.py", line 533, in _call_api
    raise ClientConnectionError('{} {}'.format(
instagram_private_api.errors.ClientConnectionError: URLError <urlopen error Tunnel connection failed: 407 Proxy Authentication Required>
Arsi44 commented 2 years ago

api = Client(username, password, proxy='http://username:password@ip:port')

kkm commented 1 year ago

api = Client(username, password, proxy='http://username:password@ip:port')

api = Client(username, password, proxy='http://username:password@ip:port', settings=cache_settings)

I hope, its right.