http経由でidigiにデータを送信するPythonスクリプトを実行しています。Mac でスクリプトを実行すると問題なく動作し、サーバーにデータが表示されますが、Raspberry Pi から実行するとサーバーにアクセスできません。それらは同じネットワークに接続されているので、Raspberry Pi に関係していると思います。http ポートへのアクセスが拒否されていませんか? 確認方法と修正方法を教えてください。ポートが開いていることを確認する方法を検索しましたが、あまりうまくいきませんでした。何が起こっているのかよくわかりません。何か案は?
依存関係エラーは発生しません。idigiが提案したのと同じコードを使用しました。http メッセージングを処理するコードのこの部分。
# create HTTP basic authentication string, this consists of
# "username:password" base64 encoded
auth = base64.encodestring("%s:%s" % (username,password))[:-1]
# Note, this is using Secure HTTP
webservice = httplib.HTTPS(idigi)
# to what URL to send the request with a given HTTP method
webservice.putrequest("PUT", "/ws/Messaging/%s" % (filename))
# add the authorization string into the HTTP header
webservice.putheader("Authorization", "Basic %s" % (auth))
webservice.putheader("Content-type", "text/xml; charset=\"UTF-8\"")
webservice.putheader("Content-length", "%d" % len(body))
webservice.endheaders()
webservice.send(body)
# get the response
statuscode, statusmessage, header = webservice.getreply()
response_body = webservice.getfile().read()