Created
June 20, 2013 20:08
-
-
Save m0n5t3r/5826163 to your computer and use it in GitHub Desktop.
bti replacement, because Twittre decided to shut down API version 1.0 and break clients...
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
import requests | |
from requests_oauthlib import OAuth1 | |
if __name__ == '__main__': | |
consumer_key = '...' | |
consumer_secret = '...' | |
access_token_key = '...' | |
access_token_secret = '...' | |
api_url = 'https://api.twitter.com/1.1/statuses/update.json' | |
auth = OAuth1(consumer_key, consumer_secret, access_token_key, access_token_secret, signature_type='auth_header') | |
message = { | |
'status': len(sys.argv) > 1 and ' '.join(sys.argv[1:]) or sys.stdin.read(), | |
} | |
if not message['status']: | |
print 'No input data, bailing out!' | |
exit(1) | |
requests.post(api_url, message, auth=auth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment