Roy W Fileger rfileger at
Mon Feb 26 21:11:33 CET 2001


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 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("", 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', '')            # same as above
   reply, msg, hdrs = h.getreply()
   data = h.getfile().read()
   print data

Thanks, your help is greatly appreciated, Roy W. Fileger.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list