[Zope] Zope URL/Page Retrieval with Python

aschmidt at fredericksburg.com aschmidt at fredericksburg.com
Sat Nov 15 07:42:51 EST 2003


Samir Mishra <SamirMishra at cbuae.gov.ae> wrote ..
> The Zope site I'm trying to access is on another server. I'm accessing
> it
> remotely, so I can't use external methods. I wanted to access the web page
> and parse the HTML for relevant info.
> 
> And I found the answer to my question on another mailing list. If anyone's
> interested --
> 
> 
> import urllib
> 
> URLsite = "http://username:password@zserver:8080/everything/else/on/path"
> 
> usock = urllib.urlopen(URLsite)
> data = usock.read()
> usock.close()
> 

Someone else please correct me if I am wrong but we decided not to use something similar because if for some reason the site you are trying to urlopen is down, etc. then it never really times out...just sits and spins and locks that zope thread. Do that a few times and your whole site is down.

Not sure if a try: would work here but that might be worth a shot. But I guess if the urlopen never comes back then the try: would just try forever.

Am I right here or is there a better way to handle this?

Allen


More information about the Zope mailing list