Skip to content
This repository has been archived by the owner on Feb 6, 2021. It is now read-only.

Commit

Permalink
added example how to use urlfetch in pool with gevent
Browse files Browse the repository at this point in the history
  • Loading branch information
ownport committed Aug 16, 2012
1 parent b3e89d9 commit b8be251
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/gevent-pool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python2
#
# Example of usage pool with gevent
#

from gevent import monkey
monkey.patch_socket()

from gevent.pool import Pool
import urlfetch

pool = Pool(size=5)
urls = ('http://www.google.com', 'http://www.yahoo.com', 'http://www.blogger.com',
'http://www.python.org', 'http://sourceforge.net', 'http://www.ubuntu.com',
'http://www.readwriteweb.com', 'http://gigaom.com', 'http://www.wired.com', )

tasks = pool.map(urlfetch.get, urls)

0 comments on commit b8be251

Please sign in to comment.