instagram_private_api: WebAPI: Unable to get rhx_gis from init request
Please follow the guide below
- Issues submitted without this template format will be ignored.
- Please read the questions carefully and answer completely.
- Do not post screenshots of error messages or code.
- Put an
x
into all the boxes [ ] relevant to your issue (==> [x] no spaces). - Use the Preview tab to see how your issue will actually look like.
- Issues about reverse engineering is out of scope and will be closed without response.
- Any mention of spam-like actions or spam-related tools/libs/etc is strictly not allowed.
Before submitting an issue, make sure you have:
- Updated to the lastest version v1.6.0
- Read the README and docs
- Searched the bugtracker for similar issues including closed ones
- Reviewed the sample code in tests and examples
Which client are you using?
- app (
instagram_private_api/
) - web (
instagram_web_api/
)
Describe your issue
Hi everyone,
From today web api will report error “Unable to get rhx_gis from init request”. I researched about this issue in other projects, some suggest to remove rhx_gis and X-Instagram-GIS, I tried this solution, at first it could successfully login and call api, but later web api reported “instagram_web_api.errors.ClientBadRequestError”. I had also processed the challenges from IG website, but still no success any more.
Would be very nice if someone finds how to fix this new change.
Thanks.
Paste the output of python -V
here:
Code:
# Example code that will produce the error reported
from instagram_web_api import Client
api = Client(proxy=getProxy(), settings=None,
username=username, password=password)
api.login()
Error/Debug Log:
File "/Library/Python/2.7/site-packages/instagram_web_api/client.py", line 390, in login
login_res = self._make_request('https://www.instagram.com/accounts/login/ajax/', params=params)
File "/Library/Python/2.7/site-packages/instagram_web_api/client.py", line 291, in _make_request
raise ClientBadRequestError(msg, e.code)
ClientBadRequestError: HTTPError "Bad Request" while opening https://www.instagram.com/accounts/login/ajax/
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 7
- Comments: 39 (1 by maintainers)
Commits related to this issue
- Update to generate rhx_gis per instagram changes https://github.com/ping/instagram_private_api/issues/170 — committed to josephlbarnett/instagram_private_api by josephlbarnett 5 years ago
- Update to generate rhx_gis per instagram changes https://github.com/ping/instagram_private_api/issues/170 — committed to henry-lajoie-gps/instagram_private_api by josephlbarnett 5 years ago
- Fix https://github.com/ping/instagram_private_api/issues/170. — committed to jordanmkoncz/instagram_private_api by jordanmkoncz 5 years ago
- Fix ping#170 for no more rhx_gis — committed to thekensman/instagram_private_api by deleted user 5 years ago
- Fix for broken rhx_gis: https://github.com/ping/instagram_private_api/issues/170 — committed to nickw444/instagram_private_api by nickw444 5 years ago
- fixing Unable to get rhx_gis from init request (#170) — committed to eracle/instagram_private_api by eracle 4 years ago
for some reasons @pourya2374 's code gives me an error. So I edited it slightly to fix this error:
Here is the working solution as of 1 July, use MyClient instead of using the libraries class directly.
I’m getting the same issue. Using version 1.6.0, with instagram_web_api. When I call:
Client(auto_patch=True, drop_incompat_keys=False)
I getClientError: Unable to get rhx_gis from init request.
This issue is still present, why isn’t there any fix on the master branch yet?
I’ve fixed this issue with creating new class and overwrite it’s static method.
Based on two upper commenters:
line 317 in client.py
Will solve the problem
Had to make some changes to the code above to make it work:
b’tmp_str’ is just the string ‘tmp_str’, which negates the point of generating one
This works for Python 3 Here is a solution which works on 2.7 for me
@eracle I tried your fix, but as others described, now I’m getting:
Not sure how to fix per the
enc_password
parameter, as @fenchelfen pointed out.@pyinto @reformedot Instagram does not allow sending a plain text password at
accounts/login/ajax/
anymore, it requiresenc_password
parameter instead. Refer to this dilame/instagram-private-api#1010You can actually put any string there and it will work, you don’t have to extract anything. I’ve tried that myself though.
python 2.7 script version of @HashamGhuffary
Hey guys, this is web enc_password api:
https://leesoar.com/api-v1/ig?pub_key=20ed90203c457a2f9efc20820c2452403bff6424de39ff9cc928a751e07f6915&pub_id=229&pwd=xxx&t=1596703337&secret_key=a9ad0489a73146c68ec514ffce5cbaba
the secret_key have 200 times.
It returns:
{ "code": 1, "message": "ok", "enc_password": "#PWD_INSTAGRAM_BROWSER:10:1596703337:AQpQAH4W1vHVVa7730diM49fhY5Cn0CsgfGsZ5zA613WkRJDn3ujkqqwEdtnV7BrjgJsW3zinQ1OrSnTdgU2We72gWztHxM7OW2NSfvVR/4AGuCZGbR8mpk30wEzP4Z9tPLfxmr/o3Nmk6v7", "pub_key": "20ed90203c457a2f9efc20820c2452403bff6424de39ff9cc928a751e07f6915", "pub_id": "229", "pwd": "xxx", "version": 10, "t": "1596703337" }
No solutions ? i still have the same error as @agucova
@javad94 it worked for me a few weeks but suddenly I’m getting the same error:
instagram_web_api.errors.ClientBadRequestError: HTTPError "Bad Request" while opening https://www.instagram.com/accounts/login/ajax/
77db6e1c30c697195362aa4ed593
This is still an issue 😃
I do not work with this library, but I also encountered this problem. With the help of js reverse, I seem to have found a solution.
In sharedData data is output on the page. See field config->viewerId. It is now transmitted instead of rhx_gis. The string to form md5 looks like:
:{"id":"11612471724"}
, where the numbers are viewerIdin this way,
rhx_gis = md5(':{"id":"viewerId"}')
sharedData fragment:
{ "config": { "csrf_token": "xoKnKvuk9HXYAyO7nwNP9BQVxfxvlEvw", "viewerId": "11612471724" }, ...
I have the same issue. In on web mode and when I tried with Client() return rhx_gis error.
Any solution? Thanks!!
Getting same error as @pyinto
instagram_web_api.errors.ClientBadRequestError: HTTPError "Bad Request" while opening https://www.instagram.com/accounts/login/ajax