How to Convert IO Stream to XML Document

2010-09-10 Thread jakecjacobson
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 tools to do this. The problem I am getting is if I use urllib.urlopen(url

Re: Processing XML File

2010-02-01 Thread jakecjacobson
On Jan 29, 2:41 pm, Stefan Behnel wrote: > Sells, Fred, 29.01.2010 20:31: > > > Google is your friend.  Elementtree is one of the better documented > > IMHO, but there are many modules to do this. > > Unless the OP provides some more information, "do this" is rather > underdefined. And sending som

Re: Processing XML File

2010-01-29 Thread jakecjacobson
On Jan 29, 1:04 pm, Adam Tauno Williams wrote: > On Fri, 2010-01-29 at 09:25 -0800, jakecjacobson wrote: > > I need to take a XML web resource and split it up into smaller XML > > files.  I am able to retrieve the web resource but I can't find any > > good XML examples.

Processing XML File

2010-01-29 Thread jakecjacobson
I need to take a XML web resource and split it up into smaller XML files. I am able to retrieve the web resource but I can't find any good XML examples. I am just learning Python so forgive me if this question has been answered many times in the past. My resource is like: ... ...

Re: How to unencode a string

2009-08-28 Thread jakecjacobson
On Aug 27, 6:51 pm, Piet van Oostrum wrote: > >>>>> jakecjacobson (j) wrote: > >j> This seems like a real simple newbie question but how can a person > >j> unencode a string?  In Perl I use something like: "$part=~ s/\%([A-Fa- > >j> f0-9]{2})

How to unencode a string

2009-08-27 Thread jakecjacobson
This seems like a real simple newbie question but how can a person unencode a string? In Perl I use something like: "$part=~ s/\%([A-Fa- f0-9]{2})/pack('C', hex($1))/seg;" If I have a string like Word1%20Word2%20Word3 I want to get Word1 Word2 Word3. Would also like to handle special characters

Help making this script better

2009-08-06 Thread jakecjacobson
Hi, After much Google searching and trial & error, I was able to write a Python script that posts XML files to a REST API using HTTPS and passing PEM cert & key file. It seems to be working but would like some pointers on how to handle errors. I am using Python 2.4, I don't have the capability t

Re: bad certificate error

2009-07-29 Thread jakecjacobson
On Jul 29, 2:08 am, "Gabriel Genellina" wrote: > En Tue, 28 Jul 2009 09:02:40 -0300, Steven D'Aprano   > escribió: > > > > > On Mon, 27 Jul 2009 23:16:39 -0300, Gabriel Genellina wrote: > > >> I don't see the point on "fixing" either the Python script or httplib to > >> accomodate for an invalid

Re: bad certificate error

2009-07-28 Thread jakecjacobson
On Jul 28, 9:48 am, Jean-Paul Calderone wrote: > On Tue, 28 Jul 2009 03:35:55 -0700 (PDT), jakecjacobson > wrote: > > [snip] > > >"Invalid how?  Self signed certificate? Domain mismatch? Expired > >certificate?"  It is a server name mismatch. > > P

Re: bad certificate error

2009-07-28 Thread jakecjacobson
On Jul 28, 3:29 am, Nick Craig-Wood wrote: > jakecjacobson wrote: > >  I am getting the following error when doing a post to REST API, > > >  Enter PEM pass phrase: > >  Traceback (most recent call last): > >    File "./ices_catalog_feeder.py",

Re: bad certificate error

2009-07-27 Thread jakecjacobson
On Jul 27, 2:23 pm, "Gabriel Genellina" wrote: > En Mon, 27 Jul 2009 12:57:40 -0300, jakecjacobson   > escribió: > > > I was wondering if this is due to the server having a invalid server > > cert?  If I go to this server in my browser, I get a "This serv

bad certificate error

2009-07-27 Thread jakecjacobson
Hi, I am getting the following error when doing a post to REST API, Enter PEM pass phrase: Traceback (most recent call last): File "./ices_catalog_feeder.py", line 193, in ? main(sys.argv[1]) File "./ices_catalog_feeder.py", line 60, in main post2Catalog(catalog_host, catalog_port, ca

Re: exceptions.TypeError an integer is required

2009-07-27 Thread jakecjacobson
On Jul 24, 3:11 pm, Steven D'Aprano wrote: > On Fri, 24 Jul 2009 11:24:58 -0700, jakecjacobson wrote: > > I am trying to do a post to a REST API over HTTPS and requires the > > script to pass a cert to the server.  I am getting "exceptions.TypeError > > an integ

exceptions.TypeError an integer is required

2009-07-24 Thread jakecjacobson
I am trying to do a post to a REST API over HTTPS and requires the script to pass a cert to the server. I am getting "exceptions.TypeError an integer is required" error and can't find the reason. I commenting out the lines of code, it is happening on the connection.request() line. Here is the pr

Authenticating to web service using https and client certificate

2009-06-23 Thread jakecjacobson
Hi, I need to post some XML files to a web client that requires a client certificate to authenticate. I have some code that works on posting a multipart form over http but I need to modify it to pass the proper certificate and post the XML file. Is there any example code that will point me in th

Re: FTP example going through a FTP Proxy

2009-01-08 Thread jakecjacobson
On Jan 7, 3:56 pm, jakecjacobson wrote: > On Jan 7, 2:11 pm, jakecjacobson wrote: > > > > > On Jan 7, 12:32 pm, jakecjacobson wrote: > > > > Hi, > > > > I need to write a simple Python script that I can connect to a FTP > > > server and do

FTP example going through a FTP Proxy

2009-01-08 Thread jakecjacobson
Hi, I need to write a simple Python script that I can connect to a FTP server and download files from the server to my local box. I am required to go through a FTP Proxy and I don't see any examples on how to do this. The FTP proxy doesn't require username or password to connect but the FTP serv

Re: FTP example going through a FTP Proxy

2009-01-07 Thread jakecjacobson
On Jan 7, 2:11 pm, jakecjacobson wrote: > On Jan 7, 12:32 pm, jakecjacobson wrote: > > > Hi, > > > I need to write a simple Python script that I can connect to a FTP > > server and download files from the server to my local box.  I am > > required to go throug

Re: FTP example going through a FTP Proxy

2009-01-07 Thread jakecjacobson
On Jan 7, 12:32 pm, jakecjacobson wrote: > Hi, > > I need to write a simple Python script that I can connect to a FTP > server and download files from the server to my local box.  I am > required to go through a FTP Proxy and I don't see any examples on how > to do this.

Getting/Setting HTTP Headers

2008-09-17 Thread jakecjacobson
I need to write a feed parser that takes a url for any Atom or RSS feed and transform it into an Atom feed. I done the transformation part but I want to support conditional HTTP requests. I have not been able to find any examples that show: 1. How to read the Last_Modified or ETag header value