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

[BUG] user_followers_gql_chunk() raises AttributeError #90

Open
luca-arch opened this issue Aug 26, 2024 · 1 comment
Open

[BUG] user_followers_gql_chunk() raises AttributeError #90

luca-arch opened this issue Aug 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@luca-arch
Copy link

Try HikerAPI SaaS with a free trial https://hikerapi.com/p/KhMxYMSn

Describe the bug

AttributeError: 'NoneType' object has no attribute 'cookies'

To Reproduce

  1. Log in via session as per Use Sessions
  2. Await user_followers_gql_chunk()
  3. See the exception

Traceback

INFO:aiograpi:https://i.instagram.com/api/v1/feed/timeline/
INFO:httpx:HTTP Request: POST https://i.instagram.com/api/v1/feed/timeline/ "HTTP/1.1 200 OK"
INFO:graphql_request:*****@mail.com [200] POST https://i.instagram.com/api/v1/feed/timeline/ (269.0.0.18.75, OnePlus 6T Dev)
ERROR:root:'NoneType' object has no attribute 'cookies'
Traceback (most recent call last):
  File "/mnt/modules/instafollow/worker/copier.py", line 134, in process
    await copy_user_followers()
  File "/mnt/modules/instafollow/worker/copier.py", line 119, in copy_user_followers
    resp = await ig_client.user_followers_gql_chunk(user_id, end_cursor = None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiograpi/mixins/user.py", line 732, in user_followers_gql_chunk
    self.inject_sessionid_to_public()
  File "/usr/local/lib/python3.12/site-packages/aiograpi/mixins/auth.py", line 851, in inject_sessionid_to_public
    self.graphql.set_cookies(cookie)
  File "/usr/local/lib/python3.12/site-packages/aiograpi/reqwests.py", line 87, in set_cookies
    self._client.cookies.set(k, v)
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'cookies'

Desktop (please complete the following information):

  • OS: python:3.12.5-bookworm (arm Docker image)
  • Python version 3.12.5
  • aiograpi 0.0.3
  • moveipy n/a
  • imagemagick n/a

Additional context
I think this relates to #59, as the self._set_client() setter is never invoked

@luca-arch luca-arch added the bug Something isn't working label Aug 26, 2024
@luca-arch
Copy link
Author

luca-arch commented Aug 26, 2024

Current workaround:

async def my_copy_user_followers(user_id: int, end_cursor: str = None):
+   # Workaround for https://github.com/subzeroid/aiograpi/issues/90
+   ig_client.graphql._set_client()
    resp = await ig_client.user_followers_gql_chunk(user_id, end_cursor = None)

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

8 participants
@luca-arch and others