Twitter.jl
Twitter.jl copied to clipboard
post_status_update with media?
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