Allow packets / data not to be decoded
This commit is contained in:
parent
95d8e8bfe5
commit
a48c5f7f71
1 changed files with 11 additions and 3 deletions
|
@ -29,9 +29,17 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
|
||||||
length = int(self.headers['Content-Length'])
|
length = int(self.headers['Content-Length'])
|
||||||
post_data = self.rfile.read(length).decode('utf-8')
|
post_data = self.rfile.read(length).decode('utf-8')
|
||||||
|
|
||||||
payload = self.dataToString(post_data)
|
try:
|
||||||
deveui = self.dataToDevEUI(post_data)
|
payload = self.dataToString(post_data)
|
||||||
print("{}:{}".format(deveui, payload))
|
except UnicodeDecodeError:
|
||||||
|
payload = ""
|
||||||
|
|
||||||
|
try:
|
||||||
|
deveui = self.dataToDevEUI(post_data)
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
deveui = ""
|
||||||
|
|
||||||
|
print("deveui/payload: {}:{}".format(deveui, payload))
|
||||||
|
|
||||||
# And insert into the db
|
# And insert into the db
|
||||||
self.insert_json("swisscom", post_data, payload, deveui)
|
self.insert_json("swisscom", post_data, payload, deveui)
|
||||||
|
|
Loading…
Reference in a new issue