Hey first post, I'm really stuck on httplib2. I read about this with diveintopython3.org, but it doesn't say anything about the timeout function. I am looking at the documentation, but the only thing I see is the ability to put an int timeout, but no units are indicated (seconds? Milliseconds? What is the default value if not?) This is what I have (I also have code to check that the answer is and try again, but he never tried more than once)
h = httplib2.Http('.cache', timeout=None) for url in list: response, content = h.request(url) more stuff...
This way the Http object stays around until some arbitrary time, but I load a ton of pages from the same server, and after a while it freezes when I receive the page. Errors do not occur, the thing just hangs on the page. So I try:
h = httplib2.Http('.cache', timeout=None) for url in list: try: response, content = h.request(url) except: h = httplib2.Http('.cache', timeout=None) more stuff...
But then it recreates another Http object each time (it follows the path βexceptβ). I donβt understand how to keep receiving with the same object until it expires and I will do another one. Also, is there a way to set a timeout on an individual request?
Thanks for the help!
source share