Skip to content
This repository was archived by the owner on Oct 1, 2023. It is now read-only.
This repository was archived by the owner on Oct 1, 2023. It is now read-only.

api.post function from example.py gives me the following error #51

@kousha789123

Description

@kousha789123

Login status: Success
[ERROR] Failed to decode response as JSON
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/threads_api/src/http_sessions/aiohttp_session.py", line 36, in post
resp = json.loads(text)
File "/usr/local/Cellar/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.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/kouroshshafi/Desktop/twitter-threads-kourosh/twitter-threads.py", line 214, in
asyncio.run(post()) # Posts a message.
File "/usr/local/Cellar/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/Cellar/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/kouroshshafi/Desktop/twitter-threads-kourosh/twitter-threads.py", line 144, in post
result = await api.post("Hello World API test!")
File "/usr/local/lib/python3.10/site-packages/threads_api/src/threads_api.py", line 107, in wrapper
return await func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/threads_api/src/threads_api.py", line 1105, in post
res = await self._private_post(url=post_url, headers=headers,data=payload)
File "/usr/local/lib/python3.10/site-packages/threads_api/src/threads_api.py", line 107, in wrapper
return await func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/threads_api/src/threads_api.py", line 166, in _private_post
return await self._auth_session.post(**kwargs)
File "/usr/local/lib/python3.10/site-packages/threads_api/src/http_sessions/aiohttp_session.py", line 42, in post
raise Exception('Failed to decode response as JSON')
Exception: Failed to decode response as JSON
ERROR:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x12549f100>
ERROR:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x1254afb20>, 69683.022677739)]']
connector: <aiohttp.connector.TCPConnector object at 0x12549f070>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions