Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public method for user_info_by_username_gql throws a simplejson.errors.JSONDecodeError[BUG] #1889

Open
golden23 opened this issue Apr 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@golden23
Copy link

Describe the bug
I'm trying to get user information by public method [user_info_by_username_gql(username)], but I'm getting a "simplejson.errors.JSONDecodeError" error

To Reproduce

cl = Client()
cl.delay_range = [1, 5]
user_name = "cristiano"
user_info = cl.user_info_by_username_gql(user_name)
print(user_info)

Traceback

Traceback (most recent call last):
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/instagrapi/mixins/public.py", line 172, in _send_public_request
    self.last_public_json = response.json()
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/gongdx/py_project/network_monitor/scripts/test2/Instagram_spider/instagraapi_demo.py", line 325, in <module>
    scraper_user_demo_anonymous(target_user)
  File "/Users/gongdx/py_project/network_monitor/scripts/test2/Instagram_spider/instagraapi_demo.py", line 304, in scraper_user_demo_anonymous
    user_info = cl.user_info_by_username_gql(user_name)
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/instagrapi/mixins/user.py", line 144, in user_info_by_username_gql
    return extract_user_gql(self.public_a1_request(f"/{username!s}/")["user"])
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/instagrapi/mixins/public.py", line 216, in public_a1_request
    response = self.public_request(
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/instagrapi/mixins/public.py", line 122, in public_request
    raise e
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/instagrapi/mixins/public.py", line 99, in public_request
    return self._send_public_request(url, **kwargs)
  File "/Users/gongdx/py_project/network_monitor/venv/lib/python3.9/site-packages/instagrapi/mixins/public.py", line 186, in _send_public_request
    raise ClientJSONDecodeError(
instagrapi.exceptions.ClientJSONDecodeError: JSONDecodeError Expecting value: line 1 column 1 (char 0) while opening https://www.instagram.com/cristiano/
@golden23 golden23 added the bug Something isn't working label Apr 22, 2024
@golden23
Copy link
Author

golden23 commented Apr 22, 2024

the same error with another public methods like : user_following_gql,user_followers_gql,user_info_gql...

@SaeidB
Copy link
Contributor

SaeidB commented May 7, 2024

fix for user info #1868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants