How to use the geventhttpclient.response.HTTPSocketResponse function in geventhttpclient

To help you get started, we’ve selected a few geventhttpclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gwik / geventhttpclient / src / geventhttpclient / httplib.py View on Github external
httplib = __import__('httplib')
from geventhttpclient import response
import gevent.socket
import gevent.ssl


class HTTPResponse(response.HTTPSocketResponse):

    def __init__(self, sock, method='GET', strict=0, debuglevel=0,
            buffering=False, **kw):
        if method is None:
            method = 'GET'
        else:
            method = method.upper()
        super(HTTPResponse, self).__init__(sock, method=method, **kw)

    @property
    def version(self):
        v = self.get_http_version()
        if v == 'HTTP/1.1':
            return 11
        return 10
github gwik / geventhttpclient / src / geventhttpclient / httplib.py View on Github external
from geventhttpclient import header
import gevent.socket



class HTTPLibHeaders(header.Headers):

    def __getitem__(self, key):
        value = super(HTTPLibHeaders, self).__getitem__(key)
        if isinstance(value, (list, tuple)):
            return ", ".join(value)
        else:
            return value


class HTTPResponse(response.HTTPSocketResponse):

    def __init__(self, sock, method='GET', strict=0, debuglevel=0,
            buffering=False, **kw):
        if method is None:
            method = 'GET'
        else:
            method = method.upper()
        super(HTTPResponse, self).__init__(sock, method=method, **kw)

    @property
    def msg(self):
        if hasattr(self, '_msg'):
            return self._msg
        self._msg = HTTPLibHeaders(self._headers_index)
        return self._msg