Re: How to test a URL request in a "while True" loop

2010-01-13 Thread Aahz
In article , Aahz wrote: >In article , >Philip Semanchuk wrote: >> >>While I don't fully understand what you're trying to accomplish by >>changing the URL to google.com after 3 iterations, I suspect that some >>of your trouble comes from using "while True". Your code would be >>clearer if

Re: How to test a URL request in a "while True" loop

2010-01-13 Thread Aahz
In article , Philip Semanchuk wrote: > >While I don't fully understand what you're trying to accomplish by >changing the URL to google.com after 3 iterations, I suspect that some >of your trouble comes from using "while True". Your code would be >clearer if the while clause actually stated

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Steve Holden
Brian D wrote: [...] > I'm definitely acquiring some well-deserved schooling -- and it's > really appreciated. I'd seen the "is/is not" preference before, but it > just didn't stick. > Yes, a lot of people have acquired the majority of their Python education from this list - I have certainly learn

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 7:08 pm, MRAB wrote: > Brian D wrote: > > Thanks MRAB as well. I've printed all of the replies to retain with my > > pile of essential documentation. > > > To follow up with a complete response, I'm ripping out of my mechanize > > module the essential components of the solution I got to

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread MRAB
Brian D wrote: Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the solution I got to work. The main body of the code passes a URL to

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the solution I got to work. The main body of the code passes a URL to the scrape_record

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 12:31 pm, Philip Semanchuk wrote: > On Dec 30, 2009, at 11:00 AM, Brian D wrote: > > > > > I'm actually using mechanize, but that's too complicated for testing > > purposes. Instead, I've simulated in a urllib2 sample below an attempt > > to test for a valid URL request. > > > I'm attem

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread MRAB
Brian D wrote: On Dec 30, 11:06 am, samwyse wrote: On Dec 30, 10:00 am, Brian D wrote: What I don't understand is how to test for a valid URL request, and then jump out of the "while True" loop to proceed to another line of code below the loop. There's probably faulty logic in this approach.

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Philip Semanchuk
On Dec 30, 2009, at 11:00 AM, Brian D wrote: I'm actually using mechanize, but that's too complicated for testing purposes. Instead, I've simulated in a urllib2 sample below an attempt to test for a valid URL request. I'm attempting to craft a loop that will trap failed attempts to request a U

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 11:06 am, samwyse wrote: > On Dec 30, 10:00 am, Brian D wrote: > > > What I don't understand is how to test for a valid URL request, and > > then jump out of the "while True" loop to proceed to another line of > > code below the loop. There's probably faulty logic in this approach. I >

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread samwyse
On Dec 30, 10:00 am, Brian D wrote: > What I don't understand is how to test for a valid URL request, and > then jump out of the "while True" loop to proceed to another line of > code below the loop. There's probably faulty logic in this approach. I > imagine I should wrap the URL request in a fu

How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
I'm actually using mechanize, but that's too complicated for testing purposes. Instead, I've simulated in a urllib2 sample below an attempt to test for a valid URL request. I'm attempting to craft a loop that will trap failed attempts to request a URL (in cases where the connection intermittently