Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will it support retry after raising a timeout exception? #26

Closed
ClericPy opened this issue Nov 8, 2015 · 0 comments
Closed

Will it support retry after raising a timeout exception? #26

ClericPy opened this issue Nov 8, 2015 · 0 comments

Comments

@ClericPy
Copy link

ClericPy commented Nov 8, 2015

such as @threads(50,timeout=1), will easily raise an error, so how to retry the func then?
thanks for answering.

urls = ['http://p.3.cn/prices/mgets?skuIds=J_1273600'] * 1000
import time
import requests
# from multiprocessing.dummy import Pool
from tomorrow import threads


@threads(50,timeout=0.1)
def download(url):
    return requests.get(url)

if __name__ == "__main__":
    start = time.time()
    responses = [download(url) for url in urls]
    html = [len(response.text) for response in responses]
    print(html)
    end = time.time()
    print("Time: %f seconds" % (end - start))

some codes

@ClericPy ClericPy closed this as completed Jan 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant