コード例 #1
0
def process_auth_options(parser, options):
  """Configures process-wide authentication parameters based on |options|."""
  # Validate that authentication method is known.
  if options.auth_method not in dict(net.AUTH_METHODS):
    parser.error('Invalid --auth-method value: %s' % options.auth_method)

  # Process the rest of the flags based on actual method used.
  # Only oauth is configurable now.
  config = None
  if options.auth_method == 'oauth':
    config = oauth.extract_oauth_config_from_options(options)

  # Now configure 'net' globally to use this for every request.
  net.configure_auth(options.auth_method, config)
コード例 #2
0
def process_auth_options(parser, options):
  """Configures process-wide authentication parameters based on |options|."""
  # Validate that authentication method is known.
  if options.auth_method not in dict(net.AUTH_METHODS):
    parser.error('Invalid --auth-method value: %s' % options.auth_method)

  # Process the rest of the flags based on actual method used.
  # Only oauth is configurable now.
  config = None
  if options.auth_method == 'oauth':
    config = oauth.extract_oauth_config_from_options(options)

  # Now configure 'net' globally to use this for every request.
  net.configure_auth(options.auth_method, config)
コード例 #3
0
ファイル: auth.py プロジェクト: Tkkg1994/Platfrom-kccat6
def process_auth_options(parser, options):
  """Configures process-wide authentication parameters based on |options|."""
  if options.auth_method not in net.AUTH_METHODS:
    parser.error('Invalid --auth-method value: %s' % options.auth_method)
  net.configure_auth(options.auth_method, oauth_options=options)