https
Roy W Fileger
rfileger at bellsouth.net
Mon Feb 26 15:11:33 EST 2001
Hello,
I am new to Python but am excited about it. I have a
requirement to send a Credit Card transaction to an
HTTPS server as the body of a POST transaction.
With Python 2.0 supporting OpenSSL, can I simply
use the httplib to connect and POST? The POST
example the Python Library Reference 11.4.2 seems
both simple and clear.
So far I have only been executing sample code from
the many sources and then making modifications to
attempt to insure that I understand.
Visa says I can confirm the availability of the gateway
by browsing https://ssl.pgs.wcom.net/ and this works
Here is a .py I have developed based upon examples
in the Python Library Reference and the information
provided by Visa re: VirtualNet SSL Gateway but I get
a socket error: host not found.
===============================================================
tran1 = ('0x82'+'D4.999995'+'0x03'+'0xD1') # provided by Visa
def sendTran(ccTran):
h = httplib.HTTP("https://ssl.pgs.wcom.net", 443) # my interpretation of Visa data
h.putrequest("POST", "/scripts/gateway.dll?Transact HTTP/1.0") # my use Visa data
h.putheader("Content-Type", "x-Visa-II/x-auth") # per Visa
h.putheader("Content-Length", "%d" % len(tran1))
h.putheader('Accept', 'text/plain')
h.putheader('Host', 'https://ssl.pgs.wcom.net') # same as above
h.endheaders()
h.send(ccTran)
reply, msg, hdrs = h.getreply()
data = h.getfile().read()
#
print data
sendTran(tran1)
================================================================
Thanks, your help is greatly appreciated, Roy W. Fileger.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20010226/225f3390/attachment.html>
More information about the Python-list
mailing list