[Tutor] URL test function.

Jeff Honey jeffh at pona.net
Fri Oct 22 16:54:47 CEST 2010

I am trying to create a function to plug into a restart script I'm creating. I can't seem to successfully loop through making an http connection, if it fails to retry, if it succeeds, to end and continue with its parent function.

I'm  using the Fabric project's module and including my functions in fabfile.py.

the most rudimentary I've got right now is this:


def is_ready():
 with settings(
  except urllib2.URLError:

I am trying to get the 'host_string' environment variable to plug in here but not sure if the parent function will pass along that information nor if I can call it like this. Additionally, I have never used try/except so I don't know if this will just try twice and quit. As it is now, it raises URLError and bombs out.

¤ kyoboku kazeoshi ¤

More information about the Tutor mailing list