Requests should be HTTP POST with a JSON content body, and Content-Type application/json; charset=UTF-8 or text/plain; charset=UTF-8.
I also checked the code for the request method of the TwitterAPI class and it seems like its always using the data attribute instead of the json attribute when it tries to use v1.1 endpoints.
I'm trying to add alt text to an image using the
media/metadata/create
endpoint but I'm getting the following error:Here's my code:
I checked the docs for this endpoint and it says:
I also checked the code for the request method of the TwitterAPI class and it seems like its always using the
data
attribute instead of thejson
attribute when it tries to use v1.1 endpoints.https://github.com/geduldig/TwitterAPI/blob/5c07c02fce51302e747190a47b6c6796fee23352/TwitterAPI/TwitterAPI.py#L203-L207
I think We can fix this issue if We tweak the
if
statement. We can do something like this: