How to use the geventhttpclient.__version__ 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 / client.py View on Github external
return len(body)
    except TypeError:
        try:
            return os.fstat(body.fileno()).st_size
        except (AttributeError, OSError):
            return None


class HTTPClient(object):
    HTTP_11 = 'HTTP/1.1'
    HTTP_10 = 'HTTP/1.0'

    BLOCK_SIZE = 1024 * 4  # 4KB

    DEFAULT_HEADERS = Headers({
        'User-Agent': 'python/gevent-http-client-' + __version__
    })

    @classmethod
    def from_url(cls, url, **kw):
        if not isinstance(url, URL):
            url = URL(url)
        enable_ssl = url.scheme == PROTO_HTTPS
        if not enable_ssl:
            kw.pop('ssl_options', None)
        return cls(url.host, port=url.port, ssl=enable_ssl, **kw)

    def __init__(self, host, port=None, headers=None,
                 block_size=BLOCK_SIZE,
                 connection_timeout=ConnectionPool.DEFAULT_CONNECTION_TIMEOUT,
                 network_timeout=ConnectionPool.DEFAULT_NETWORK_TIMEOUT,
                 disable_ipv6=False,