Skip to content

Instantly share code, notes, and snippets.

@tatic0
Created September 22, 2015 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatic0/1175fbf192f8255c5cc7 to your computer and use it in GitHub Desktop.
Save tatic0/1175fbf192f8255c5cc7 to your computer and use it in GitHub Desktop.
from twython import Twython
import linecache
import os
import sys
HOME = os.path.expanduser('~/')
passfile= HOME + '.passfile.text'
APP_KEY = linecache.getline(passfile,1).strip()
APP_SECRET = linecache.getline(passfile,2).strip()
OAUTH_TOKEN = linecache.getline(passfile,3).strip()
OAUTH_TOKEN_SECRET = linecache.getline(passfile,4).strip()
twitter = Twython(APP_KEY, APP_SECRET)
auth = twitter.get_authentication_tokens()
print(auth)
twitter = Twython(APP_KEY, APP_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
credentials = twitter.verify_credentials()
#print(credentials['profile_image_url'])
tweet = sys.argv[1] + " | #Twython"
#twitter.update_status(status='See how easy using #Twython is!')
## debug:
print(tweet)
# it's a good idea to measure the length
# of the string before tweeting
# update twitter status with a actual tweet
twitter.update_status(status=tweet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment