Last active
December 15, 2015 04:09
-
-
Save michaelhelmick/5199754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
from requests_oauthlib import OAuth1 | |
auth = OAuth1('*APP_KEY*', '*APP_SECRET*', | |
'*OAUTH_TOKEN*', '*OAUTH_TOKEN_SECRET*', | |
signature_type='auth_header') | |
file_ = open('/path/to/file/image.jpg', 'rb') | |
requests.post('https://api.twitter.com/1.1/statuses/update_with_media.json', | |
data={'status': 'Hey'}, | |
files={'media': (os.path.basename(file_.name), file_)}, | |
auth=auth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment