Using a function for regular expression substitution

2010-08-29 Thread naugiedoggie
Hello, I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s) : return urllib.quote(string.capwords(urllib.unquote(s.group('provider' The purpose of this function is to proper-case the words contained in a URL query string

Re: Using a function for regular expression substitution

2010-08-30 Thread naugiedoggie
On Aug 29, 1:14 pm, MRAB pyt...@mrabarnett.plus.com wrote: On 29/08/2010 15:22, naugiedoggie wrote: I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s) :      return urllib.quote(string.capwords(urllib.unquote(s.group

Re: Using a function for regular expression substitution

2010-08-30 Thread naugiedoggie
On Aug 30, 8:52 am, naugiedoggie michael.a.p...@gmail.com wrote: On Aug 29, 1:14 pm, MRAB pyt...@mrabarnett.plus.com wrote: On 29/08/2010 15:22, naugiedoggie wrote: I'm having a problem with using a function as the replacement in re.sub(). Here is the function: def normalize(s

Installing Python as Scripting Language in IIS

2010-08-30 Thread naugiedoggie
Hello, Windows 2003, 64-bit, standard edition server with IIS 6.0. I followed the MS instruction sheets on setting up CGI application with Python as scripting engine. I'm just getting 404 for the test script, whereas an html file in the same virtual directory is properly displayed. Here:

Trap Authentication Errors in HTTP Request

2010-09-10 Thread naugiedoggie
Hello, I have a script that authenticates to a web service provider to retrieve data. This script provides an authentication header built in a very basic way like this: code # Creates an authentication object with the credentials for a given URL def createPasswordManager(headers) :

SOLVED: Re: Trap Authentication Errors in HTTP Request

2010-09-11 Thread naugiedoggie
On Sep 10, 12:09 pm, naugiedoggie michael.a.p...@gmail.com wrote: Hello, I have a script that authenticates to a web service provider to retrieve data.  This script provides an authentication header built in a very basic way like this: The answer is that there is something whacked

Bug: urllib2 basic authentication does not trap auth failure in windows?

2010-09-11 Thread naugiedoggie
Hello, Is this a known issue? I have a script that authenticates to a web service. urllib2 process for authenticating for basic auth is supposed to dump out after 5 retries. Here's a note from the urllib2.py code: code def http_error_auth_reqed(self, auth_header, host, req, headers):

Re: How to Convert IO Stream to XML Document

2010-09-11 Thread naugiedoggie
On Sep 10, 12:20 pm, jakecjacobson jakecjacob...@gmail.com wrote: I am trying to build a Python script that reads a Sitemap file and push the URLs to a Google Search Appliance.  I am able to fetch the XML document and parse it with regular expressions but I want to move to using native XML