Twitter.jl icon indicating copy to clipboard operation
Twitter.jl copied to clipboard

post_status_update with media?

Open milankl opened this issue 4 years ago • 0 comments

using Twitter
twitterauth(...)
post_status_update(status="Test tweet")

works fine for me, but how does one include media, e.g. a png file? TwitterAPI seems to implement it as

api = TwitterAPI(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET)
file = open('Your_image.png', 'rb')
data = file.read()
r = api.request('statuses/update_with_media', {'status':'Your tweet'}, {'media[]':data})

with data being of type bytes

In [4]: type(open("folder/file.png","rb").read())
Out[4]: bytes

milankl avatar Jul 27 '21 10:07 milankl