0
我有一個python腳本運行,通過http發送數據給idigi。當我在我的Mac上運行腳本時,它工作正常,數據顯示在服務器上,但是從Raspberry Pi運行時,它無法訪問服務器。它們連接在同一個網絡中,所以我認爲它與Raspberry Pi有關。 訪問http端口是否被拒絕?我該如何檢查以及如何解決?我搜查瞭如何確保港口是開放的,但沒有走得很遠。不太確定發生了什麼事。有任何想法嗎?Raspberry Pi idigi http messaging
我沒有得到任何依賴性錯誤。我使用了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()