Source

gevent-gtkloop / somescript.py

Full commit


from gtkloop import GtkLoop
from gevent.hub import Hub
import gevent.socket

Hub.loop_class = GtkLoop
Hub.resolver_class = 'gevent.socket.BlockingResolver'


sock = gevent.socket.create_connection(('127.0.0.1', 8000))
sock.sendall('GET / HTTP/1.1\r\nHost: google.com\r\n\r\n')
gevent.sleep(0.1)
print sock.recv(1000)