# 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 collections
import contextlib
import logging
import socket
import time
import httplib2
import six
from six.moves import http_client
from six.moves.urllib import parse
from apitools.base.py import exceptions
from apitools.base.py import util
      if ':' not in connection_key:
        continue
      http_levels[connection_key] = connection.debuglevel
      connection.set_debuglevel(level)
  yield
  httplib2.debuglevel = old_level
  if http is not None:
    for connection_key, old_level in http_levels.items():
      if connection_key in http.connections:
        http.connections[connection_key].set_debuglevel(old_level)


class Request(object):
  """Class encapsulating the data for an HTTP request."""

  def __init__(self, url='', http_method='GET', headers=None, body=''):
    self.url = url
    self.http_method = http_method
    self.headers = headers or {}
    self.__body = None
    self.__loggable_body = None
    self.body = body

  @property
  def loggable_body(self):
    return self.__loggable_body

  @loggable_body.setter
  def loggable_body(self, value):
    if self.body is None:

# 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/http_wrapper.py
import collections
import contextlib
import logging
import socket
import time
import httplib2
import six
from six.moves import http_client
from six.moves.urllib import parse
from apitools.base.py import exceptions
from apitools.base.py import util

      if ':' not in connection_key:
        continue
      http_levels[connection_key] = connection.debuglevel
      connection.set_debuglevel(level)
  yield
  httplib2.debuglevel = old_level
  if http is not None:
    for connection_key, old_level in http_levels.items():
      if connection_key in http.connections:
        http.connections[connection_key].set_debuglevel(old_level)


class Request(object):
  """Class encapsulating the data for an HTTP request."""

  def __init__(self, url='', http_method='GET', headers=None, body=''):
    self.url = url
    self.http_method = http_method
    self.headers = headers or {}
    self.__body = None
    self.__loggable_body = None
    self.body = body

  @property
  def loggable_body(self):
    return self.__loggable_body

  @loggable_body.setter
  def loggable_body(self, value):
    if self.body is None:

      raise exceptions.RequestError(