Danie1 / threads-api

Unofficial Python API for Meta's Threads App
https://pypi.org/project/threads-api/
MIT License
108 stars 15 forks source link

Like don't work #35

Closed MsLolita closed 12 months ago

MsLolita commented 12 months ago

Seems as api was changed. Traceback (most recent call last): File "D:\user\prog\threads_bot\v2\tests\test.py", line 21, in loop.run_until_complete(main()) File "C:\Users\Bou\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "D:\user\prog\threads_bot\v2\tests\test.py", line 17, in main await post() File "D:\user\prog\threads_bot\v2\tests\test.py", line 9, in post result = await api.like_post("1") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\user\prog\threads_bot\v2\venv\Lib\site-packages\threads_api\src\threads_api.py", line 501, in like_post return res["status"] == "ok"


TypeError: 'NoneType' object is not subscriptable
```

from threads_api.src.threads_api import ThreadsAPI
import asyncio
import os

async def post():
    api = ThreadsAPI()
    await api.login("user", "pass", cached_token_path="..\\data\\.session")
    result = await api.like_post("1")
    print(result)
    if result:
        print("Post has been successfully posted")
    else:
        print("Unable to post.")

async def main():
    await post()

# Create an event loop and run the main function
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```

By hands, on phone, liking works.
Danie1 commented 12 months ago

Fixing this at this moment. Thanks for opening an issue! :)

Fixed here: https://github.com/Danie1/threads-api/pull/36