Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
from geventhttpclient import httplib
httplib.patch()
from urllib2 import urlopen
print urlopen('https://www.google.fr/').read()
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