473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

python equivalent of VB code sample

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
2 2972
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
9
by: Bart Nessux | last post by:
I am using method 'a' below to pick 25 names from a pool of 225. A co-worker is using method 'b' by running it 25 times and throwing out the winning name (names are associated with numbers) after...
1
by: Orr, Steve | last post by:
I'm looking to architect a 4-tier or N-tier Python web/CGI app with database connection pooling for high performance. Is there a Python equivalent to Sun's now famous Java PetStore application? (Or...
82
by: Edward Elliott | last post by:
This is just anecdotal, but I still find it interesting. Take it for what it's worth. I'm interested in hearing others' perspectives, just please don't turn this into a pissing contest. I'm in...
26
by: Christoph Zwerschke | last post by:
You will often hear that for reasons of fault minimization, you should use a programming language with strict typing: http://turing.une.edu.au/~comp284/Lectures/Lecture_18/lecture/node1.html I...
4
by: pmcgover | last post by:
I enjoyed Paul Barry's September article in Linux Journal entitled, "Web Reporting with MySQL, CSS and Perl". It provides a simple, elegant way to use HTML to display database content without any...
0
by: Gabriel Genellina | last post by:
En Thu, 08 May 2008 09:11:56 -0300, Michael Mabin <d3vvnull@gmail.comescribió: Like this? <code> import sys,fileinput for line in fileinput.input(inplace=True):...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.