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] direct_threads #2146

Closed
1tsmhmd opened this issue Mar 10, 2025 · 2 comments · May be fixed by #2159
Closed

[BUG] direct_threads #2146

1tsmhmd opened this issue Mar 10, 2025 · 2 comments · May be fixed by #2159
Labels
bug Something isn't working

Comments

@1tsmhmd
Copy link

1tsmhmd commented Mar 10, 2025

I am unable to access direct messages, despite being correctly logged in.

from instagrapi import Client

cl = Client()
login = cl.login_by_sessionid("sdfggb9478693764fcad")
print(login)

direct = cl.direct_threads(amount=10)
print(direct)

I get this error.

PS C:\Users\Administrator\Desktop\python> py .\idownloader.py
True
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\python\idownloader.py", line 8, in <module>
    direct = cl.direct_threads(amount=10)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\instagrapi\mixins\direct.py", line 88, in direct_threads
    threads_chunk, cursor = self.direct_threads_chunk(
                            ~~~~~~~~~~~~~~~~~~~~~~~~~^
        selected_filter, box, thread_message_limit, cursor
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\instagrapi\mixins\direct.py", line 153, in direct_threads_chunk
    threads.append(extract_direct_thread(thread))
                   ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\instagrapi\extractors.py", line 288, in extract_direct_thread
    data["inviter"] = extract_user_short(data["inviter"])
                      ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\instagrapi\extractors.py", line 195, in extract_user_short
    data["pk"] = data.get("id", data.get("pk", None))
                 ^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

Image

@1tsmhmd 1tsmhmd added the bug Something isn't working label Mar 10, 2025
@1tsmhmd 1tsmhmd changed the title [BUG] [BUG] direct_threads Mar 10, 2025
@s8ngyu
Copy link

s8ngyu commented Mar 24, 2025

#2159

you can try this.

@1tsmhmd
Copy link
Author

1tsmhmd commented Mar 24, 2025

#2159

you can try this.

Thank you ❤️

@1tsmhmd 1tsmhmd closed this as completed Mar 24, 2025
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

Successfully merging a pull request may close this issue.

2 participants