Module Expr Str Assign NameStore Str Assign NameStore ListLoad Str Import alias ImportFrom alias identifier Import alias Import alias Import alias ImportFrom alias ImportFrom alias TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body ImportFrom alias Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad Str Expr Call AttributeLoad NameLoad attr Str Str Str Expr Call AttributeLoad NameLoad attr Str ListLoad Num Num Str ClassDef bases AttributeLoad NameLoad attr body Expr Str Assign NameStore Dict decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Num Index Num Assign NameStore Call NameLoad Call NameLoad NameLoad Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults vararg body Expr Str Pass decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Assign NameStore NameLoad Assign NameStore Num For NameStore AttributeLoad NameLoad attr body Assign NameStore NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Pass orelse Assign NameStore NameLoad Break Assign AttributeStore NameLoad attr NameLoad If AttributeLoad NameLoad attr body Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad orelse Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Str Print NameLoad Print If AttributeLoad NameLoad attr body Print Str Print Str Print If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr If CompareIn Str AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str If CompareIn Str AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Str orelse Assign NameStore Str While CompareEq Call AttributeLoad NameLoad attr Str body Assign NameStore Call NameLoad Str Assign NameStore Call AttributeLoad Call NameLoad Str attr TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Print Str Return NameLoad decorator_list
N/A N/A Command-line tools for authenticating via OAuth 1.0

Do the OAuth 1.0 Three Legged Dance for
a command line application. Stores the generated
credentials in a common file that is used by
other example apps in the same directory.
 N/A __author__ jcgregorio@google.com (Joe Gregorio) N/A __all__ N/A run N/A BaseHTTPServer google3.pyglib flags gflags N/A logging N/A socket N/A sys optparse OptionParser apiclient.oauth RequestError N/A N/A urlparse parse_qsl N/A N/A N/A ImportError N/A cgi parse_qsl N/A FLAGS N/A gflags FLAGS N/A N/A N/A gflags DEFINE_boolean auth_local_webserver True Run a local web server to handle redirects during OAuth authorization. N/A N/A N/A gflags DEFINE_string auth_host_name localhost Host name to use when running a local web server to handle redirects during OAuth authorization. N/A N/A N/A gflags DEFINE_multi_int auth_host_port N/A 8080 8090 Port to use when running a local web server to handle redirects during OAuth authorization. ClientRedirectServer N/A N/A BaseHTTPServer HTTPServer N/A N/A A server to handle OAuth 1.0 redirects back to localhost.

  Waits for a single request and parses the query parameters
  into query_params and then stops serving.
   N/A query_params N/A N/A ClientRedirectHandler N/A N/A BaseHTTPServer BaseHTTPRequestHandler N/A N/A A handler for OAuth 1.0 redirects back to localhost.

  Waits for a single request and parses the query parameters
  into the servers query_params and then stops serving.
   do_GET N/A N/A s N/A N/A N/A Handle a GET request

    Parses the query parameters and prints a message
    if the flow has completed. Note that we can't detect
    if an error occurred.
     N/A N/A N/A s send_response 200 N/A N/A N/A s send_header Content-type text/html N/A N/A N/A s end_headers N/A query N/A N/A N/A N/A s path split ? 1 N/A -1 N/A query N/A dict N/A parse_qsl query N/A N/A N/A s server query_params query N/A N/A N/A N/A s wfile write <html><head><title>Authentication Status</title></head> N/A N/A N/A N/A s wfile write <body><p>The authentication flow has completed.</p> N/A N/A N/A N/A s wfile write </body></html> N/A log_message N/A N/A self format N/A args N/A N/A Do not log messages to stdout while running as command line program. N/A N/A N/A run N/A N/A flow storage N/A N/A N/A Core code for a command-line application.

  Args:
    flow: Flow, an OAuth 1.0 Flow to step through.
    storage: Storage, a Storage to store the credential in.

  Returns:
    Credentials, the obtained credential.

  Exceptions:
    RequestError: if step2 of the flow fails.
  Args:
   N/A N/A FLAGS auth_local_webserver N/A N/A success False N/A port_number 0 N/A port N/A FLAGS auth_host_port N/A N/A port_number port N/A N/A N/A httpd N/A N/A BaseHTTPServer HTTPServer N/A N/A FLAGS auth_host_name port ClientRedirectHandler N/A N/A N/A N/A socket error N/A e N/A N/A N/A N/A success True N/A N/A N/A FLAGS auth_local_webserver success N/A N/A FLAGS auth_local_webserver N/A N/A oauth_callback N/A http://%s:%s/ N/A N/A FLAGS auth_host_name port_number N/A N/A oauth_callback oob N/A authorize_url N/A N/A flow step1_get_authorize_url oauth_callback N/A Go to the following link in your browser: N/A authorize_url N/A N/A N/A FLAGS auth_local_webserver N/A N/A If your browser is on a different machine then exit and re-run this N/A application with the command-line parameter --noauth_local_webserver. N/A N/A N/A FLAGS auth_local_webserver N/A N/A N/A N/A httpd handle_request N/A N/A error N/A httpd query_params N/A N/A N/A N/A sys exit Authentication request was rejected. N/A N/A oauth_verifier N/A httpd query_params N/A N/A code N/A N/A httpd query_params N/A oauth_verifier N/A N/A accepted n N/A N/A N/A N/A accepted lower n N/A N/A accepted N/A raw_input Have you authorized me? (y/n)  N/A code N/A N/A N/A raw_input What is the verification code?  strip N/A N/A N/A credentials N/A N/A flow step2_exchange code N/A N/A N/A RequestError N/A N/A N/A N/A sys exit The authentication has failed. N/A N/A N/A storage put credentials N/A N/A N/A credentials set_store N/A storage put N/A You have successfully authenticated. N/A credentials N/A