Re: urllib.urlopen and https question

2006-01-10 Thread bowman . joseph
That's what I get for scimming the documentation too quickly.

Got it, thanks!

For anyone else working on something similar, here is all I did... mind
you, this is my first experience with python.

# subclass of FancyURLopener so we can override the
prompt_user_password method
class DBCheckUrlOpener(urllib.FancyURLopener):
def prompt_user_passwd(self, host, realm):
"""3 args will be passed, so just catch them.
"""
sys.exit("Bad user authentication for db check.")

-- 
http://mail.python.org/mailman/listinfo/python-list


urllib.urlopen and https question

2006-01-10 Thread bowman . joseph
Hi,

I'm new to python. I've been handed the job of modifying a script we
have here at work that pulls content from a zope site, to create static
html. They wanted a check to make sure the database is up, while
pulling, to avoid errors.

I got it pretty much working how I want without any problems. It's
actually an error check I'm having a problem with.

Usernames and passwords change I'm using urlib.urlopen to open a
connection to a https url using the format of
https://username:[EMAIL PROTECTED] This works great. However, if I put in
the wrong username, the python script prompts for user validation,
rather than giving an error.

The script is not interactive, will be run by cron. So I can't just let
it hang. I'm trying to figure out if there is a way to catch that
prompt and error out within the python script, rather that writing an
expect wrapper for it. The less interpeters I have to use, the better
for my cpu.

-- 
http://mail.python.org/mailman/listinfo/python-list