@@ -104,10 +104,9 @@ def _retrieve_token(self, login: str, password: str) -> str:
104
104
def heartbeat (self ) -> Response :
105
105
"""Updates the last ping of the device
106
106
107
- Example::
108
- >>> from pyroclient import client
109
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
110
- >>> response = api_client.heartbeat()
107
+ >>> from pyroclient import client
108
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
109
+ >>> response = api_client.heartbeat()
111
110
112
111
Returns:
113
112
HTTP response containing the update device info
@@ -124,10 +123,9 @@ def update_my_location(
124
123
) -> Response :
125
124
"""Updates the location of the device
126
125
127
- Example::
128
- >>> from pyroclient import client
129
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
130
- >>> response = api_client.update_my_location(lat=10., lon=-5.45)
126
+ >>> from pyroclient import client
127
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
128
+ >>> response = api_client.update_my_location(lat=10., lon=-5.45)
131
129
132
130
Returns:
133
131
HTTP response containing the update device info
@@ -138,10 +136,9 @@ def update_my_location(
138
136
def create_event (self , lat : float , lon : float ) -> Response :
139
137
"""Register an event (e.g wildfire).
140
138
141
- Example::
142
- >>> from pyroclient import client
143
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
144
- >>> response = api_client.create_event(lat=10., lon=-5.45)
139
+ >>> from pyroclient import client
140
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
141
+ >>> response = api_client.create_event(lat=10., lon=-5.45)
145
142
146
143
Args:
147
144
lat: the latitude of the event
@@ -158,10 +155,9 @@ def create_no_alert_site(
158
155
) -> Response :
159
156
"""Create a site that is not supposed to generate alerts.
160
157
161
- Example::
162
- >>> from pyroclient import client
163
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
164
- >>> response = api_client.create_no_alert_site(lat=10., lon=-5.45, name="farm", country="FR", geocode="01")
158
+ >>> from pyroclient import client
159
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
160
+ >>> response = api_client.create_no_alert_site(lat=10., lon=-5.45, name="farm", country="FR", geocode="01")
165
161
166
162
Args:
167
163
lat: the latitude of the site
@@ -189,10 +185,9 @@ def send_alert(
189
185
) -> Response :
190
186
"""Raise an alert to the API.
191
187
192
- Example::
193
- >>> from pyroclient import client
194
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
195
- >>> response = api_client.send_alert(lat=10., lon=-5.45, device_id=3, azimuth=2.)
188
+ >>> from pyroclient import client
189
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
190
+ >>> response = api_client.send_alert(lat=10., lon=-5.45, device_id=3, azimuth=2.)
196
191
197
192
Args:
198
193
lat: the latitude of the alert
@@ -223,10 +218,9 @@ def send_alert_from_device(
223
218
) -> Response :
224
219
"""Raise an alert to the API from a device (no need to specify device ID).
225
220
226
- Example::
227
- >>> from pyroclient import client
228
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
229
- >>> response = api_client.send_alert_from_device(lat=10., lon=-5.45)
221
+ >>> from pyroclient import client
222
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
223
+ >>> response = api_client.send_alert_from_device(lat=10., lon=-5.45)
230
224
231
225
Args:
232
226
lat: the latitude of the alert
@@ -250,10 +244,9 @@ def send_alert_from_device(
250
244
def create_media (self , device_id : int ) -> Response :
251
245
"""Create a media entry
252
246
253
- Example::
254
- >>> from pyroclient import client
255
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
256
- >>> response = api_client.create_media(device_id=3)
247
+ >>> from pyroclient import client
248
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
249
+ >>> response = api_client.create_media(device_id=3)
257
250
258
251
Args:
259
252
device_id: ID of the device that created that media
@@ -267,10 +260,9 @@ def create_media(self, device_id: int) -> Response:
267
260
def create_media_from_device (self ):
268
261
"""Create a media entry from a device (no need to specify device ID).
269
262
270
- Example::
271
- >>> from pyroclient import client
272
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
273
- >>> response = api_client.create_media_from_device()
263
+ >>> from pyroclient import client
264
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "DEVICE_LOGIN", "MY_PWD")
265
+ >>> response = api_client.create_media_from_device()
274
266
275
267
Returns:
276
268
HTTP response containing the created media
@@ -281,11 +273,10 @@ def create_media_from_device(self):
281
273
def upload_media (self , media_id : int , media_data : bytes ) -> Response :
282
274
"""Upload the media content
283
275
284
- Example::
285
- >>> from pyroclient import client
286
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
287
- >>> with open("path/to/my/file.ext", "rb") as f: data = f.read()
288
- >>> response = api_client.upload_media(media_id=1, media_data=data)
276
+ >>> from pyroclient import client
277
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
278
+ >>> with open("path/to/my/file.ext", "rb") as f: data = f.read()
279
+ >>> response = api_client.upload_media(media_id=1, media_data=data)
289
280
290
281
Args:
291
282
media_id: ID of the associated media entry
@@ -305,10 +296,9 @@ def upload_media(self, media_id: int, media_data: bytes) -> Response:
305
296
def get_my_devices (self ) -> Response :
306
297
"""Get the devices who are owned by the logged user
307
298
308
- Example::
309
- >>> from pyroclient import client
310
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
311
- >>> response = api_client.get_my_devices()
299
+ >>> from pyroclient import client
300
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
301
+ >>> response = api_client.get_my_devices()
312
302
313
303
Returns:
314
304
HTTP response containing the list of owned devices
@@ -318,10 +308,9 @@ def get_my_devices(self) -> Response:
318
308
def get_sites (self ) -> Response :
319
309
"""Get all the existing sites in the DB
320
310
321
- Example::
322
- >>> from pyroclient import client
323
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
324
- >>> response = api_client.get_sites()
311
+ >>> from pyroclient import client
312
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
313
+ >>> response = api_client.get_sites()
325
314
326
315
Returns:
327
316
HTTP response containing the list of sites
@@ -331,10 +320,9 @@ def get_sites(self) -> Response:
331
320
def get_all_alerts (self ) -> Response :
332
321
"""Get all the existing alerts in the DB
333
322
334
- Example::
335
- >>> from pyroclient import client
336
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
337
- >>> response = api_client.get_all_alerts()
323
+ >>> from pyroclient import client
324
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
325
+ >>> response = api_client.get_all_alerts()
338
326
339
327
Returns:
340
328
HTTP response containing the list of all alerts
@@ -344,10 +332,9 @@ def get_all_alerts(self) -> Response:
344
332
def get_ongoing_alerts (self ) -> Response :
345
333
"""Get all the existing alerts in the DB that have the status 'start'
346
334
347
- Example::
348
- >>> from pyroclient import client
349
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
350
- >>> response = api_client.get_ongoing_alerts()
335
+ >>> from pyroclient import client
336
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
337
+ >>> response = api_client.get_ongoing_alerts()
351
338
352
339
Returns:
353
340
HTTP response containing the list of all ongoing alerts
@@ -358,10 +345,9 @@ def get_ongoing_alerts(self) -> Response:
358
345
def get_unacknowledged_events (self ) -> Response :
359
346
"""Get all the existing events in the DB that have the field "is_acknowledged" set to `False`
360
347
361
- Example::
362
- >>> from pyroclient import client
363
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
364
- >>> response = api_client.get_unacknowledged_events()
348
+ >>> from pyroclient import client
349
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
350
+ >>> response = api_client.get_unacknowledged_events()
365
351
366
352
Returns:
367
353
HTTP response containing the list of all events that haven't been acknowledged
@@ -371,10 +357,9 @@ def get_unacknowledged_events(self) -> Response:
371
357
def acknowledge_event (self , event_id : int ) -> Response :
372
358
"""Switch the `is_acknowledged` field value of the event to `True`
373
359
374
- Example::
375
- >>> from pyroclient import client
376
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
377
- >>> response = api_client.acknowledge_event(event_id=1)
360
+ >>> from pyroclient import client
361
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
362
+ >>> response = api_client.acknowledge_event(event_id=1)
378
363
379
364
Args:
380
365
event_id: ID of the associated event entry
@@ -388,10 +373,9 @@ def acknowledge_event(self, event_id: int) -> Response:
388
373
def get_site_devices (self , site_id : int ) -> Response :
389
374
"""Fetch the devices that are installed on a specific site
390
375
391
- Example::
392
- >>> from pyroclient import client
393
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
394
- >>> response = api_client.get_site_devices(1)
376
+ >>> from pyroclient import client
377
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
378
+ >>> response = api_client.get_site_devices(1)
395
379
396
380
Args:
397
381
site_id: the identifier of the site
@@ -404,10 +388,9 @@ def get_site_devices(self, site_id: int) -> Response:
404
388
def get_media_url (self , media_id : int ) -> Response :
405
389
"""Get the image as a URL
406
390
407
- Example::
408
- >>> from pyroclient import client
409
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
410
- >>> response = api_client.get_media_url(1)
391
+ >>> from pyroclient import client
392
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
393
+ >>> response = api_client.get_media_url(1)
411
394
412
395
Args:
413
396
media_id: the identifier of the media entry
@@ -421,10 +404,9 @@ def get_media_url(self, media_id: int) -> Response:
421
404
def get_media_url_and_read (self , media_id : int ) -> Response :
422
405
"""Get the image as a url and read it
423
406
424
- Example::
425
- >>> from pyroclient import client
426
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
427
- >>> response = api_client.get_media_url_and_read(1)
407
+ >>> from pyroclient import client
408
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
409
+ >>> response = api_client.get_media_url_and_read(1)
428
410
429
411
Args:
430
412
media_id: the identifier of the media entry
@@ -438,10 +420,9 @@ def get_media_url_and_read(self, media_id: int) -> Response:
438
420
def get_past_events (self ) -> Response :
439
421
"""Get all past events
440
422
441
- Example::
442
- >>> from pyroclient import client
443
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
444
- >>> response = api_client.get_past_events()
423
+ >>> from pyroclient import client
424
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
425
+ >>> response = api_client.get_past_events()
445
426
446
427
Returns:
447
428
HTTP response containing the list of past events
@@ -451,10 +432,9 @@ def get_past_events(self) -> Response:
451
432
def get_my_device (self ) -> Response :
452
433
"""Get information about the current device
453
434
454
- Example::
455
- >>> from pyroclient import client
456
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
457
- >>> response = api_client.get_my_device()
435
+ >>> from pyroclient import client
436
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
437
+ >>> response = api_client.get_my_device()
458
438
459
439
Returns:
460
440
HTTP response containing the device information
@@ -464,10 +444,9 @@ def get_my_device(self) -> Response:
464
444
def update_my_hash (self , software_hash : str ) -> Response :
465
445
"""Updates the software hash of the current device
466
446
467
- Example::
468
- >>> from pyroclient import client
469
- >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
470
- >>> response = api_client.update_my_hash()
447
+ >>> from pyroclient import client
448
+ >>> api_client = client.Client("http://pyronear-api.herokuapp.com", "MY_LOGIN", "MY_PWD")
449
+ >>> response = api_client.update_my_hash()
471
450
472
451
Returns:
473
452
HTTP response containing the updated device information
0 commit comments