Skip to content

Instantly share code, notes, and snippets.

View chrisjbray's full-sized avatar

Chris Bray chrisjbray

View GitHub Profile
@rbranson
rbranson / gevent-spawn-and-yield.py
Created August 29, 2013 05:19
Illustrates how to launch & yield to gevent greenlets from a non-gevent context.
import gevent
from gevent import httplib
def fetcher():
print "fetcher: Fetching..."
conn = httplib.HTTPConnection("www.google.com")
conn.request("GET", "/")
res = conn.getresponse()
output = res.read()