-
Notifications
You must be signed in to change notification settings - Fork 19
api.post function from example.py gives me the following error #51
Comments
Hey, please run the script with the environment variable I am speculating the login did not really succeed, despite the message. I will gladly assist once you have the additional details. |
Please re-open with additional info if still reproduces after version v1.1.13 (https://github.com/Danie1/threads-api/releases/tag/v1.1.13). It contains improvements in this area, so at the very least it will be easier to troubleshoot. |
Here is the error I get [ERROR] Failed to decode response [
var docElement = document.documentElement; window.__bufferedErrors = []; })(); /*
Unless required by applicable law or agreed to in writing, software (function(){function g(a,c){b||(b=a,f=c,h.forEach(function(a){removeEventListener(a,l,e)}),m())}function m(){b&&f&&0<d.length&&(d.forEach(function(a){a(b,f)}),d=[])}function n(a,c){function k(){g(a,c);d()}function b(){d()}function d(){removeEventListener("pointerup",k,e);removeEventListener("pointercancel",b,e)}addEventListener("pointerup",k,e);addEventListener("pointercancel",b,e)}function l(a){if(a.cancelable){var c=performance.now(),b=a.timeStamp;b>c&&(c=+new Date);c-=b;"pointerdown"==a.type?n(c,
(function(){ Oops, this is an error that hasn't yet been properly handled. During handling of the above exception, another exception occurred: Traceback (most recent call last):
var docElement = document.documentElement; window.__bufferedErrors = []; })(); /*
Unless required by applicable law or agreed to in writing, software (function(){function g(a,c){b||(b=a,f=c,h.forEach(function(a){removeEventListener(a,l,e)}),m())}function m(){b&&f&&0<d.length&&(d.forEach(function(a){a(b,f)}),d=[])}function n(a,c){function k(){g(a,c);d()}function b(){d()}function d(){removeEventListener("pointerup",k,e);removeEventListener("pointercancel",b,e)}addEventListener("pointerup",k,e);addEventListener("pointercancel",b,e)}function l(a){if(a.cancelable){var c=performance.now(),b=a.timeStamp;b>c&&(c=+new Date);c-=b;"pointerdown"==a.type?n(c,
(function(){ Oops, this is an error that hasn't yet been properly handled. |
Hey @kouroshshafi, please include the REQUEST and RESPONSE headers, like so once you run with the LOG_LEVEL=DEBUG" environment variable:
|
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>
The text was updated successfully, but these errors were encountered: