geduldig / TwitterAPI

Minimal python wrapper for Twitter's REST and Streaming APIs
936 stars 263 forks source link

Can't attach media V2 #227

Closed Thrasher2020 closed 1 year ago

Thrasher2020 commented 1 year ago

I'm uploading media with the V1.1 API and then trying to post with the V2 api. However, even though I can do it from Postman, when I use the construct :

resp = self.api2.request( "tweets", {"text": message, "media": {"media_ids": media_id}}, method_override='POST' )

I get the following error :

Error 400: [{'parameters': {'$.media.media_ids': ['"1666121026172858379"']}, 'message': '$.media.media_ids: string found, array expected'}]

For some reason media_id is being wrapped in '" - I've check and my media_id is a number with no ' or " around it. In Postman if I send it with the double quotes it works perfectly.

Debug : Media_id - in call: 1666121026172858379

Has anyone else run into this? Am I doing something wrong?

Thrasher2020 commented 1 year ago

I was having a moment - all sorted - realised it should be [media_id]

Thrasher2020 commented 1 year ago

See last comment