@@ -118,33 +118,39 @@ def send_to_luftdaten(values, id):
118
118
pm_values_json = [{"value_type" : key , "value" : val } for key , val in pm_values .items ()]
119
119
temp_values_json = [{"value_type" : key , "value" : val } for key , val in temp_values .items ()]
120
120
121
- resp_1 = requests .post (
122
- "https://api.luftdaten.info/v1/push-sensor-data/" ,
123
- json = {
124
- "software_version" : "enviro-plus 0.0.1" ,
125
- "sensordatavalues" : pm_values_json
126
- },
127
- headers = {
128
- "X-PIN" : "1" ,
129
- "X-Sensor" : id ,
130
- "Content-Type" : "application/json" ,
131
- "cache-control" : "no-cache"
132
- }
133
- )
134
-
135
- resp_2 = requests .post (
136
- "https://api.luftdaten.info/v1/push-sensor-data/" ,
137
- json = {
138
- "software_version" : "enviro-plus 0.0.1" ,
139
- "sensordatavalues" : temp_values_json
140
- },
141
- headers = {
142
- "X-PIN" : "11" ,
143
- "X-Sensor" : id ,
144
- "Content-Type" : "application/json" ,
145
- "cache-control" : "no-cache"
146
- }
147
- )
121
+ try :
122
+ resp_1 = requests .post (
123
+ "https://api.luftdaten.info/v1/push-sensor-data/" ,
124
+ json = {
125
+ "software_version" : "enviro-plus 0.0.1" ,
126
+ "sensordatavalues" : pm_values_json
127
+ },
128
+ headers = {
129
+ "X-PIN" : "1" ,
130
+ "X-Sensor" : id ,
131
+ "Content-Type" : "application/json" ,
132
+ "cache-control" : "no-cache"
133
+ }
134
+ )
135
+ except :
136
+ pass
137
+
138
+ try :
139
+ resp_2 = requests .post (
140
+ "https://api.luftdaten.info/v1/push-sensor-data/" ,
141
+ json = {
142
+ "software_version" : "enviro-plus 0.0.1" ,
143
+ "sensordatavalues" : temp_values_json
144
+ },
145
+ headers = {
146
+ "X-PIN" : "11" ,
147
+ "X-Sensor" : id ,
148
+ "Content-Type" : "application/json" ,
149
+ "cache-control" : "no-cache"
150
+ }
151
+ )
152
+ except :
153
+ pass
148
154
149
155
if resp_1 .ok and resp_2 .ok :
150
156
return True
0 commit comments