Skip to content
Browse files

minor change

  • Loading branch information...
1 parent 3521ee0 commit b0e48814b454fd01099db6746eeb29a49af47c4c @aht committed
Showing with 5 additions and 3 deletions.
  1. +3 −1 doc/index.rst
  2. +2 −2 example/retrieve_urls.py
View
4 doc/index.rst
@@ -551,12 +551,14 @@ pages:
yield url, urllib2.urlopen(url, timeout=timeout).read()
if __name__ == '__main__':
- retrieved = URLs >> ThreadPool(retrieve, poolsize=len(URLs))
+ retrieved = URLs >> ThreadPool(retrieve, poolsize=4)
for url, content in retrieved:
print '%r is %d bytes' % (url, len(content))
for url, exception in retrieved.failure:
print '%r failed: %s' % (url, exception)
+Alternatively, you could use a :class:`ProcessPool`.
+
Resources
---------
View
4 example/retrieve_urls.py
@@ -17,12 +17,12 @@
'http://news.ycombinator.com/',
]
-def retrieve(urls, timeout=10):
+def retrieve(urls, timeout=30):
for url in urls:
yield url, urllib2.urlopen(url, timeout=timeout).read()
if __name__ == '__main__':
- retrieved = URLs >> ThreadPool(retrieve, poolsize=len(URLs))
+ retrieved = URLs >> ThreadPool(retrieve, poolsize=4)
for url, content in retrieved:
print '%r is %d bytes' % (url, len(content))
for url, exception in retrieved.failure:

0 comments on commit b0e4881

Please sign in to comment.
Something went wrong with that request. Please try again.