Created
April 21, 2013 18:26
-
-
Save fliiiix/5430524 to your computer and use it in GitHub Desktop.
easy twitter cli using tweepy in python under Do What The Fuck You Want To Public License
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 tweepy | |
| #use your one keys ;) | |
| CONSUMER_KEY = '' | |
| CONSUMER_SECRET = '' | |
| auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | |
| auth_url = auth.get_authorization_url() | |
| print 'Please authorize: ' + auth_url | |
| verifier = raw_input('PIN: ').strip() | |
| auth.get_access_token(verifier) | |
| print "ACCESS_KEY = '%s'" % auth.access_token.key | |
| print "ACCESS_SECRET = '%s'" % auth.access_token.secret | |
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 tweepy | |
| import logging | |
| from time import localtime, strftime | |
| #use your one keys ;) | |
| CONSUMER_KEY = '' | |
| CONSUMER_SECRET = '' | |
| ACCESS_KEY = '' | |
| ACCESS_SECRET = '' | |
| auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | |
| auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) | |
| api = tweepy.API(auth) | |
| lt = localtime() | |
| logger = logging.getLogger('nas_Status') | |
| hdlr = logging.FileHandler('./tCLI.log') | |
| formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') | |
| hdlr.setFormatter(formatter) | |
| logger.addHandler(hdlr) | |
| logger.setLevel(logging.WARNING) | |
| logger.error(sys.argv[1]) | |
| status = sys.argv[1] + strftime(" %d.%m.%Y %H:%M", lt) | |
| try: | |
| api.update_status(status[0:140]) | |
| except Exception: | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment