python equivalent of VB code sample

mirandacascade at yahoo.com mirandacascade at yahoo.com
Fri Apr 21 08:01:13 EDT 2006


Situation is this:
1) must write application that does the following:
     a) creates an xml document, the contents of which, is a request
transaction
     b) send xml document to destination; I am assuming that a process
at destination side processes the request and sends back a response
     c) the application I'm writing must receive response and then
examine contents of response
2) hope to write client application in python
3) was provided VB code sample that does steps 1a, 1b and 1c; the
sample code is:

' <section of code that builds the string sXML; the contents of which
is a request transaction>
set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
 'Bank table image address field, location of Comm Admin.
sServer = Session("ImageAddress")
 'NT AUTH
' note: I believe the next 2 lines in this post are really one line in
VB code that wrapped
' because they didn't fit on one line in the post
objXML.open
"POST",sServer,false,Session("WebServerUserAuth"),Session("WebServerPassword")
objXML.send sXML
sXMLRs = objXML.responseText

It appears as though much of the work is handled within methods and
properties of the objXML object:
 a) the open method appears to establish the connection with the
destination side
 b) the send method appears to handle both sending the request and not
returning control back to program until a response has been provided
 c) the .responseText property appears to be the contents of the
response

My questions are:
1) is it possible to develop a python script that does the equivalent
of the code sample above?
2) is the code sample above an example of what's referred to as an
'HTTP POST'?
3) I looked in the python documentation that describes urllib, urllib2
and httplib; am I looking in the right place?
4) are there other places I should be looking, particularly if I am
seeking samples of python code that are functionally similar to the
sample code above?




More information about the Python-list mailing list