def main(): try: c_key, c_secret = get_consumer_keys() except ValueError: print >> sys.stderr, 'READABILITY_ACCESS_TOKEN and READABILITY_ACCESS_SECRET must be set.' sys.exit(1) token = get_access_token() rdd = readability.oauth(c_key, c_secret, token=token) url = raw_input('Enter a URL to bookmark: ') print url bookmark = rdd.add_bookmark(url=url) print bookmark
def main(): try: c_key, c_secret = get_consumer_keys() except ValueError: print >> sys.stderr, 'READABILITY_CONSUMER_KEY and READABILITY_CONSUMER_SECRET must be set.' sys.exit(1) try: rdd = readability.oauth(c_key, c_secret, callback=get_oauth_pin) except readability.api.AuthenticationError: print >> sys.stderr, '\nLogin failed. Invalid credentials.' sys.exit(77) if c_key and c_secret: print 'Login successful!' if '--raw' in sys.argv: print RAW_TEMPLATE % (rdd.token_tuple) else: print TEMPLATE % (rdd.token_tuple)