LinkItONEDevGroup / LASS

Location Aware Sensor System by Linkit ONE
https://www.facebook.com/groups/1607718702812067/
MIT License
157 stars 77 forks source link

Prevent the situation that the malformed entries might crash the process #19

Closed xinghc closed 8 years ago

xinghc commented 8 years ago

There is a malformed entries being occurred recently on LASS server. The content is like this:

mqtt payload=|ver_format=3|fmt_opt=1|app=WEBDUINO_COPY|date=2016-04-28|time=05:17:07|PM10=6340|PM2_5=2450|SiteName='Null'|SiteID=wa4268|gps_lat=0|gps_lon=0

It crashed the process at the line of urllib.urlencode(). IMHO, making it take care the interested MQTT entries only could solve it all.

To make it earlier to customize, I also separated the POST part logic out from on_message().