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.

Uploading post with image doesn't work anymore since today #60

@dfkt

Description

@dfkt

Uploading posts with image worked fine for a few days (even though Instagram/Threads complained via email every time about my bot being hosted in a different country, and I checked in the security setting that it's fine that way).

I've tried all three HTTP session classes in the threads-api, it makes no difference. Threads returns an error, and an HTML page twice, displaying "this page does not exist".

Full error log incl. HTML is attached below.

Oops, this is an error that hasn't yet been properly handled.
Please open an issue on Github at https://github.com/Danie1/threads-api.
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.11/site-packages/threads_api/src/threads_api.py", line 168, in _extract_response_json
    resp = json.loads(response)
           ^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/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 "/app/bot.py", line 164, in <module>
    asyncio.run(main())
  File "/app/.heroku/python/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/app/bot.py", line 159, in main
    await post_include_image(api) # Posts a message with an image.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bot.py", line 138, in post_include_image
    result = await api.post("#bot", image_path=download_img)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/threads_api/src/threads_api.py", line 107, in wrapper
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/threads_api/src/threads_api.py", line 1131, in post
    res = await self._private_post(url=post_url, headers=headers,data=payload)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/threads_api/src/threads_api.py", line 107, in wrapper
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/threads_api/src/threads_api.py", line 181, in _private_post
    resp_json = self._extract_response_json(response)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/threads_api/src/threads_api.py", line 173, in _extract_response_json
    raise Exception(f'Failed to decode response [{response}] as JSON.\n\n{OPEN_ISSUE_MESSAGE}')
Exception: Failed to decode response [<!DOCTYPE html>

threads-api-error.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions