def main(): consumer_key = 'API_KEY' consumer_secret = 'API_SECRET' tumblr_oauth = TumblrOAuthClient(consumer_key, consumer_secret) authorize_url = tumblr_oauth.get_authorize_url() print "Visit: %s" % authorize_url oauth_verifier = raw_input('What is the oauth_verifier?') access_token = tumblr_oauth.get_access_token(oauth_verifier) print "Access key:", access_token.key print "Access Secret:", access_token.secret
import os import sys from tumblr.oauth import TumblrOAuthClient if not os.environ.get("KEY", None): sys.exit("Give app key as KEY env") if not os.environ.get("SECRET", None): sys.exit("Give app key as SECRET env") if not os.environ.get("BLOG", None): sys.exit("Give blog URL as BLOG env") callback = "http://example.com/callback/" tumblr_oauth = TumblrOAuthClient(os.environ["KEY"], os.environ["SECRET"]) auth_url = tumblr_oauth.get_authorize_url() print "Connect with Tumblr via:\n%s\nThen pick oauth_verifier from the url" % auth_url oauth_verifier = raw_input('Verifier: ').strip() access_token = tumblr_oauth.get_access_token(oauth_verifier) final_oauth_token = access_token.key final_oauth_token_secret = access_token.secret # Genereate the upload script which has credentials stored out = open("upload.sh", "wt")
from tumblr.oauth import TumblrOAuthClient consumer_key = 'BmyWZMbAzcK9Y7mEQKTgf1JI4icFlXvfxxkfIzuG9nFFVJfg9Q' consumer_secret = 'p5ohAI2hT7tSwjVCI0HA8oTpOYAvc3m6tIPAXJGNXkur6PgQdT' tumblr_oauth = TumblrOAuthClient(consumer_key, consumer_secret) authorize_url = tumblr_oauth.get_authorize_url() print "visit: %s" % authorize_url oauth_verifier = raw_input('What is the oauth_verifier?') access_token = tumblr_oauth.get_access_token(oauth_verifier) print "Access key:", access_token.key print "Access Secret:", access_token.secret