httplib を使用して、クレジット カード情報を authorize.net に送信しようとしています。リクエストを投稿しようとすると、次のトレースバックが表示されます。
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
私は次のようにリクエストを作成します:
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)
これに別のレイヤーを追加するために、httplib 2.6 があり、httplib.HTTPSConnection に source_address パラメータがない開発サーバーで作業していました。
どんな助けでも大歓迎です。
================================================== =========
編集:
コマンドラインから実行できます。どうやらこれはある種の権限の問題です。これを実現するために、どのユーザーにどの権限を付与する必要があるかについてのアイデアはありますか? おそらくApacheはポートを開くことができませんか?