# Path: pyoauth/http.py
# class ResponseAdapter(object):
#     """Adaptor HTTP Response class.
# 
#     Framework implementers can subclass this class and must use it with
#     the client methods for them to work.
#     """
#     def __init__(self, status, reason, body, headers=None):
#         self._body = body
#         self._status = status
#         self._reason = reason
#         self._headers = headers or {}
# 
#     @property
#     def body(self):
#         """Payload from the response."""
#         return self._body
# 
#     @property
#     def payload(self):
#         """Payload from the response."""
#         return self._body
# 
#     @property
#     def content(self):
#         """Payload from the response."""
#         return self._body
# 
#     @property
#     def error(self):
#         """
#         Determines whether an error occurred. ``True`` or ``False``.
#         """
#         return self.status < 200 or self.status >= 300
# 
#     @property
#     def status(self):
#         """The HTTP response status code."""
#         return self._status
# 
#     @property
#     def reason(self):
#         """The HTTP response status message."""
#         return self._reason
# 
#     @property
#     def headers(self):
#         """HTTP response headers."""
#         return self._headers
# 
#     def get_header(self, name):
#         """
#         Fetches the value of a header with the given name.
# 
#         :param name:
#             The name of the header.
#         :returns:
#             Value of the header.
#         """
#         if name in self.headers:
#             return self.headers[name]
#         elif name.lower() in self.headers:
#             return self.headers[name.lower()]
#         else:
#             header_lowercased = name.lower()
#             for k, v in self.headers.items():
#                 if k.lower() == header_lowercased:
#                     return v
#             return None
# 
#     @property
#     def content_type(self):
#         """Determines the content type of the response."""
#         return self.get_header(HEADER_CONTENT_TYPE_CAPS).split(SYMBOL_SEMICOLON, 1)[0]
# 
#     def is_body_form_urlencoded(self):
#         """Determines whether the response has content type form urlencoded."""
#         return self.content_type == CONTENT_TYPE_FORM_URLENCODED
# 
#     @property
#     def content_type_encoding(self):
#         """Determines the content type of the response."""
#         header = self.get_header(HEADER_CONTENT_TYPE_CAPS)
#         if SYMBOL_SEMICOLON in header:
#             content_type, encoding = header.split(SYMBOL_SEMICOLON, 1)
#             if encoding:
#                 return encoding.strip().split(SYMBOL_EQUAL, 1)[1]
#             else:
#                 return None
#         else:
#             return None


from pyoauth.http import ResponseAdapter
            pass
#            http = _AsyncHttpClient()
#
#            if args or kwargs:
#                async_callback = partial(async_callback, *args, **kwargs)
#
#            def adapt_response(response):
#                async_callback(ResponseAdapter(response.status_code,
#                                               response.status,
#                                               response.content,
#                                               response.headers))
#            http.fetch(
#                url=request.url,
#                body=request.body,
#                method=request.method,
#                headers=request.headers,
#                callback=adapt_response,
#                deadline=10
#            )
        else:
#            try:
            response = urlfetch.fetch(
                url=request.url,
                payload=request.body,
                method=request.method,
                headers=request.headers,
                deadline=10)
#            except urlfetch.DownloadError, e:
#                logging.exception(e)
#                response = None

# Path: pyoauth/http.py
# class ResponseAdapter(object):
#     """Adaptor HTTP Response class.
# 
#     Framework implementers can subclass this class and must use it with
#     the client methods for them to work.
#     """
#     def __init__(self, status, reason, body, headers=None):
#         self._body = body
#         self._status = status
#         self._reason = reason
#         self._headers = headers or {}
# 
#     @property
#     def body(self):
#         """Payload from the response."""
#         return self._body
# 
#     @property
#     def payload(self):
#         """Payload from the response."""
#         return self._body
# 
#     @property
#     def content(self):
#         """Payload from the response."""
#         return self._body
# 
#     @property
#     def error(self):
#         """
#         Determines whether an error occurred. ``True`` or ``False``.
#         """
#         return self.status < 200 or self.status >= 300
# 
#     @property
#     def status(self):
#         """The HTTP response status code."""
#         return self._status
# 
#     @property
#     def reason(self):
#         """The HTTP response status message."""
#         return self._reason
# 
#     @property
#     def headers(self):
#         """HTTP response headers."""
#         return self._headers
# 
#     def get_header(self, name):
#         """
#         Fetches the value of a header with the given name.
# 
#         :param name:
#             The name of the header.
#         :returns:
#             Value of the header.
#         """
#         if name in self.headers:
#             return self.headers[name]
#         elif name.lower() in self.headers:
#             return self.headers[name.lower()]
#         else:
#             header_lowercased = name.lower()
#             for k, v in self.headers.items():
#                 if k.lower() == header_lowercased:
#                     return v
#             return None
# 
#     @property
#     def content_type(self):
#         """Determines the content type of the response."""
#         return self.get_header(HEADER_CONTENT_TYPE_CAPS).split(SYMBOL_SEMICOLON, 1)[0]
# 
#     def is_body_form_urlencoded(self):
#         """Determines whether the response has content type form urlencoded."""
#         return self.content_type == CONTENT_TYPE_FORM_URLENCODED
# 
#     @property
#     def content_type_encoding(self):
#         """Determines the content type of the response."""
#         header = self.get_header(HEADER_CONTENT_TYPE_CAPS)
#         if SYMBOL_SEMICOLON in header:
#             content_type, encoding = header.split(SYMBOL_SEMICOLON, 1)
#             if encoding:
#                 return encoding.strip().split(SYMBOL_EQUAL, 1)[1]
#             else:
#                 return None
#         else:
#             return None


# Path: pyoauth/tornado/httpclient.py
from pyoauth.http import ResponseAdapter

            pass
#            http = _AsyncHttpClient()
#
#            if args or kwargs:
#                async_callback = partial(async_callback, *args, **kwargs)
#
#            def adapt_response(response):
#                async_callback(ResponseAdapter(response.status_code,
#                                               response.status,
#                                               response.content,
#                                               response.headers))
#            http.fetch(
#                url=request.url,
#                body=request.body,
#                method=request.method,
#                headers=request.headers,
#                callback=adapt_response,
#                deadline=10
#            )
        else:
#            try:
            response = urlfetch.fetch(
                url=request.url,
                payload=request.body,
                method=request.method,
                headers=request.headers,
                deadline=10)
#            except urlfetch.DownloadError, e:
#                logging.exception(e)
#                response = None

            return ResponseAdapter(response.status_code, response.status,