ping / instagram_private_api

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

Login error #129

Closed dobrovolsky closed 5 years ago

dobrovolsky commented 5 years ago

There are login errors with both api (web and private). Do you have any suggestions?

Which client are you using?


Describe the Bug/Error:

Python 3.6.1

Web:

Code:

from hashtag_hound.users.models import InstagramBotUser
from instagram_web_api import Client

user = InstagramBotUser(username='x', password='x')
web_api = Client(username=user.username, password=user.password, auto_patch=True, authenticate=True)

user_feed_info = web_api.user_feed('329452045', count=1)
    for post in user_feed_info:
        print(post)

Error/Debug Log:

Traceback (most recent call last):
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_web_api/client.py", line 265, in _make_request
    res = self.opener.open(req, data=data, timeout=self.timeout)
  File "/usr/local/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/beat_test.py", line 14, in <module>
    web_api = Client(username=user.username, password=user.password, auto_patch=True, authenticate=True)
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_web_api/client.py", line 134, in __init__
    self.login()
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_web_api/client.py", line 344, in login
    login_res = self._make_request('https://www.instagram.com/accounts/login/ajax/', params=params)
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_web_api/client.py", line 282, in _make_request
    raise ClientError('HTTPError "{0!s}" while opening {1!s}'.format(e.reason, url), e.code)
instagram_web_api.errors.ClientError: HTTPError "Bad Request" while opening https://www.instagram.com/accounts/login/ajax/

Private:

Code:

from hashtag_hound.users.models import InstagramBotUser
from instagram_private_api import Client

user = InstagramBotUser(username='x', password='x')
web_api = Client(username=user.username, password=user.password, auto_patch=True)

user_feed_info = web_api.user_feed('329452045', count=1)
    for post in user_feed_info:
        print(post)

Error/Debug Log:

Traceback (most recent call last):
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_private_api/client.py", line 506, in _call_api
    response = self.opener.open(req, timeout=self.timeout)
  File "/usr/local/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/beat_test.py", line 14, in <module>
    web_api = Client(username=user.username, password=user.password, auto_patch=True, authenticate=True)
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_private_api/client.py", line 197, in __init__
    self.login()
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_private_api/endpoints/accounts.py", line 50, in login
    'accounts/login/', params=login_params, return_response=True)
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_private_api/client.py", line 510, in _call_api
    ErrorHandler.process(e, error_response)
  File "/home/vagrant/venv/lib/python3.6/site-packages/instagram_private_api/errors.py", line 125, in process
    error_response=json.dumps(error_obj)
instagram_private_api.errors.ClientCheckpointRequiredError: checkpoint_challenge_required
wlerin commented 5 years ago

instagram_private_api.errors.ClientCheckpointRequiredError: checkpoint_challenge_required

Login via a browser, it's asking you for a captcha.

ping commented 5 years ago

https://instagram-private-api.readthedocs.io/en/latest/faq.html#what-does-checkpoint-challenge-required-challenge-required-mean

rewiaca commented 3 years ago

https://instagram-private-api.readthedocs.io/en/latest/faq.html#what-does-checkpoint-challenge-required-challenge-required-mean

How exactly do it manually? If cookies is the best options, so what string format is need to be so _pickle.UnpicklingError: unpickling stack underflow won't show? Default JSON format is not suitable as i see. Or there are another meaning by "manually", is there are any example? Thanks

instagram_private_api.errors.ClientCheckpointRequiredError: checkpoint_challenge_required

Login via a browser, it's asking you for a captcha.

Logged in through several browsers, solved challenges, but not for python script

ehsanonline commented 3 years ago

I think this issue should be re-open or another similar one should be open. I can not login with web_api and I don't have challenge problem.