By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,934 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,934 IT Pros & Developers. It's quick & easy.

python equivalent of VB code sample

P: n/a
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?

Apr 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
mi************@yahoo.com wrote:
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


This code is dealing with XMLHTTP request.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Apr 21 '06 #2

P: n/a
Thank you for pointing me in the direction of XMLHTTP. I'm still
thinking about this in terms of creating a python script that is
functionally equivalent to the VB code in the original post. The
information I reviewed about XMLHTTP makes me think that it may be
possible to use the win32com.client to provide the python script with
the same methods and properties that the VB program is using.

Is win32com.client what I should be using? The Dispatch method of
win32com.client?

Apr 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.