I am trying to use httplib to send authorize.net credit card information. When I try to send a request, I get the following trace:
File "./lib/cgi_app.py", line 139, in run res = method() File "/var/www/html/index.py", line 113, in ProcessRegistration conn.request("POST", "/gateway/transact.dll", mystring, headers) File "/usr/local/lib/python2.7/httplib.py", line 946, in request self._send_request(method, url, body, headers) File "/usr/local/lib/python2.7/httplib.py", line 987, in _send_request self.endheaders(body) File "/usr/local/lib/python2.7/httplib.py", line 940, in endheaders self._send_output(message_body) File "/usr/local/lib/python2.7/httplib.py", line 803, in _send_output self.send(msg) File "/usr/local/lib/python2.7/httplib.py", line 755, in send self.connect() File "/usr/local/lib/python2.7/httplib.py", line 1152, in connect self.timeout, self.source_address) File "/usr/local/lib/python2.7/socket.py", line 567, in create_connection raise error, msg gaierror: [Errno -2] Name or service not known
I create my request like this:
mystring = urllib.urlencode(cardHash) headers = {"Content-Type": "text/xml", "Content-Length": str(len(mystring))} conn = httplib.HTTPSConnection("secure.authorize.net:443", source_address=("myurl.com", 443)) conn.request("POST", "/gateway/transact.dll", mystring, headers)
to add another layer to it, it worked on our development server with httplib 2.6 and without the source_address parameter in httplib.HTTPSConnection.
Any help is greatly appreciated.
==================================================== ==========
EDIT:
I can run it from the command line. Apparently this is some kind of permission issue. Any ideas what permissions I need to grant so that users can do this? Perhaps Apache cannot open the port?