Client of the Pyronear API to help the fight against wildfires
Project description
API Client
Client for the Pyronear API
Table of Contents
Getting started
Prerequisites
- Python 3.6 (or more recent)
- pip
Installation
You can clone and install the project dependencies as follows:
$git clone https://github.com/pyronear/pyro-api.git $pip install -e pyro-api/client/.
Usage
Import the client
from pyroclient import client
Create a client object by handling him the API keys
API_URL = "http://pyronear-api.herokuapp.com" CREDENTIALS_LOGIN = "George Abitbol" CREDENTIALS_PASSWORD = "AStrong Password" api_client = client.Client(API_URL, CREDENTIALS_LOGIN, CREDENTIALS_PASSWORD)
Use it to query alerts:
#AS A DEVICE: ## Create a device event_id = api_client.create_event(lat=10, lon=10).json()["id"] ## Create a media media_id = api_client.create_media_from_device().json()["id"] ## Create an alert linked to the media and the event api_client.send_alert_from_device(lat=10, lon=10, event_id=event_id, media_id=media_id) ## Upload an image on the media dummy_image = "https://ec.europa.eu/jrc/sites/jrcsh/files/styles/normal-responsive/" \ + "public/growing-risk-future-wildfires_adobestock_199370851.jpeg" image_data = requests.get(dummy_image) api_client.upload_media(media_id=media_id, image_data=image_data.content) ## Update your position: api_client.update_my_location(lat=1, lon=2, pitch=3)
License
Distributed under the GPLv3 License. See LICENSE
for more information.
Documentation
The full project documentation is available here for detailed specifications. The documentation was built with Sphinx using a theme provided by Read the Docs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size pyroclient-0.1.1-py3-none-any.whl (17.7 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size pyroclient-0.1.1.tar.gz (18.1 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for pyroclient-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a2e9c0766e135c391d1765c8c6404da02eb44d24bf823306806d974a71b305a |
|
MD5 | 24e82f7f6b19ebee9f81e367f29cffeb |
|
BLAKE2-256 | 987ec22fdd068f5d463aeb4d366eee5f84f386864d43ed08fb5ffab5126fc20e |