How to use the geventhttpclient.httplib.patch 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 / examples / httplib2_patched.py View on Github external
from geventhttpclient import httplib
httplib.patch()

from httplib2 import Http


http = Http()
response, content = http.request('http://google.fr/')
assert response.status == 200
assert content
print response
print content

response, content = http.request('http://google.fr/', method='HEAD')
assert response.status == 200
assert content == ''
print response
github gwik / geventhttpclient / examples / urllib_patched.py View on Github external
from geventhttpclient import httplib
httplib.patch()

from urllib2 import urlopen


print urlopen('https://www.google.fr/').read()
github gwik / geventhttpclient / benchmarks / httplib2_patched.py View on Github external
if __name__ == "__main__":

    from geventhttpclient import httplib
    httplib.patch()

    import httplib2
    import time
    import gevent.queue
    import gevent.pool
    from contextlib import contextmanager

    class ConnectionPool(object):

        def __init__(self, factory, size=5):
            self.factory = factory
            self.queue = gevent.queue.Queue(size)
            for i in xrange(size):
                self.queue.put(factory())

        @contextmanager