# Path: apitools/base/py/exceptions.py
# class Error(Exception):
# class TypecheckError(Error, TypeError):
# class NotFoundError(Error):
# class UserError(Error):
# class InvalidDataError(Error):
# class CommunicationError(Error):
# class HttpError(CommunicationError):
# class InvalidUserInputError(InvalidDataError):
# class InvalidDataFromServerError(InvalidDataError, CommunicationError):
# class BatchError(Error):
# class ConfigurationError(Error):
# class GeneratedClientError(Error):
# class ConfigurationValueError(UserError):
# class ResourceUnavailableError(Error):
# class CredentialsError(Error):
# class TransferError(CommunicationError):
# class TransferRetryError(TransferError):
# class TransferInvalidError(TransferError):
# class RequestError(CommunicationError):
# class RetryAfterError(HttpError):
# class BadStatusCodeError(HttpError):
# class NotYetImplementedError(GeneratedClientError):
# class StreamExhausted(Error):
#   def __init__(self, response, content, url):
#   def __str__(self):
#   def status_code(self):
#   def FromResponse(cls, http_response):
#   def __init__(self, response, content, url, retry_after):
#   def FromResponse(cls, http_response):
# 
# Path: apitools/base/py/util.py
# _RESERVED_URI_CHARS = r":/?#[]@!$&'()*+,;="
# def DetectGae():
# def DetectGce():
# def NormalizeScopes(scope_spec):
# def Typecheck(arg, arg_type, msg=None):
# def ExpandRelativePath(method_config, params, relative_path=None):
# def CalculateWaitForRetry(retry_attempt, max_wait=60):
# def AcceptableMimeType(accept_patterns, mime_type):
#   def MimeTypeMatches(pattern, mime_type):
# def MapParamNames(params, request_type):
# def MapRequestParams(params, request_type):


import datetime
import json
import os
import httplib2
import oauth2client
import oauth2client.client
import oauth2client.gce
import oauth2client.locked_file
import oauth2client.multistore_file
import oauth2client.tools  # for flag declarations
import logging
  import gflags as flags
from six.moves import http_client
from six.moves import urllib
from apitools.base.py import exceptions
from apitools.base.py import util
    from google.appengine.api import app_identity
        from oauth2client import tools





try:
  FLAGS = flags.FLAGS
except ImportError:
  FLAGS = None


__all__ = [
    'CredentialsFromFile',
    'GaeAssertionCredentials',
    'GceAssertionCredentials',
    'GetCredentials',
    'GetUserinfo',
    'ServiceAccountCredentials',
    'ServiceAccountCredentialsFromFile',
]



# TODO(craigcitro): Expose the extra args here somewhere higher up,
# possibly as flags in the generated CLI.
def GetCredentials(package_name, scopes, client_id, client_secret, user_agent,
                   credentials_filename=None,
                   service_account_name=None, service_account_keyfile=None,
                   api_key=None, client=None):
  """Attempt to get credentials, using an oauth dance as the last resort."""

# Path: apitools/base/py/exceptions.py
# class Error(Exception):
# class TypecheckError(Error, TypeError):
# class NotFoundError(Error):
# class UserError(Error):
# class InvalidDataError(Error):
# class CommunicationError(Error):
# class HttpError(CommunicationError):
# class InvalidUserInputError(InvalidDataError):
# class InvalidDataFromServerError(InvalidDataError, CommunicationError):
# class BatchError(Error):
# class ConfigurationError(Error):
# class GeneratedClientError(Error):
# class ConfigurationValueError(UserError):
# class ResourceUnavailableError(Error):
# class CredentialsError(Error):
# class TransferError(CommunicationError):
# class TransferRetryError(TransferError):
# class TransferInvalidError(TransferError):
# class RequestError(CommunicationError):
# class RetryAfterError(HttpError):
# class BadStatusCodeError(HttpError):
# class NotYetImplementedError(GeneratedClientError):
# class StreamExhausted(Error):
#   def __init__(self, response, content, url):
#   def __str__(self):
#   def status_code(self):
#   def FromResponse(cls, http_response):
#   def __init__(self, response, content, url, retry_after):
#   def FromResponse(cls, http_response):
# 
# Path: apitools/base/py/util.py
# _RESERVED_URI_CHARS = r":/?#[]@!$&'()*+,;="
# def DetectGae():
# def DetectGce():
# def NormalizeScopes(scope_spec):
# def Typecheck(arg, arg_type, msg=None):
# def ExpandRelativePath(method_config, params, relative_path=None):
# def CalculateWaitForRetry(retry_attempt, max_wait=60):
# def AcceptableMimeType(accept_patterns, mime_type):
#   def MimeTypeMatches(pattern, mime_type):
# def MapParamNames(params, request_type):
# def MapRequestParams(params, request_type):


# Path: apitools/base/py/credentials_lib.py
import datetime
import json
import os
import httplib2
import oauth2client
import oauth2client.client
import oauth2client.gce
import oauth2client.locked_file
import oauth2client.multistore_file
import oauth2client.tools  # for flag declarations
import logging
  import gflags as flags
from six.moves import http_client
from six.moves import urllib
from apitools.base.py import exceptions
from apitools.base.py import util
    from google.appengine.api import app_identity
        from oauth2client import tools






try:
  FLAGS = flags.FLAGS
except ImportError:
  FLAGS = None


__all__ = [
    'CredentialsFromFile',
    'GaeAssertionCredentials',
    'GceAssertionCredentials',
    'GetCredentials',
    'GetUserinfo',
    'ServiceAccountCredentials',
    'ServiceAccountCredentialsFromFile',
]



# TODO(craigcitro): Expose the extra args here somewhere higher up,
# possibly as flags in the generated CLI.
def GetCredentials(package_name, scopes, client_id, client_secret, user_agent,
                   credentials_filename=None,
                   service_account_name=None, service_account_keyfile=None,
                   api_key=None, client=None):
  """Attempt to get credentials, using an oauth dance as the last resort."""

  scopes = util.NormalizeScopes(scopes)