pulse.eco API wrapper
Project description
pulse-eco
pulse.eco API wrapper for Python.
>>> import pulseeco as pe
>>> pulse_eco = pe.PulseEco(auth=('user', 'pass'))
>>> pulse_eco.overall('skopje')
{'cityName': 'skopje',
'values': {'no2': '36',
'o3': '6',
'pm25': '63',
'pm10': '88',
'temperature': '11',
'humidity': '75',
'pressure': '980',
'noise_dba': '45'}}
>>> pulse_eco.current('skopje')
[{'sensorId': '1005',
'stamp': '2022-01-06T16:00:00Z',
'type': 'no2',
'position': '41.9992,21.4408',
'value': '62'},
{'sensorId': '1004',
'stamp': '2022-01-06T16:00:00Z',
'type': 'no2',
'position': '42.0036,21.4636',
'value': '6'}, ...]
Installation
pulse-eco is avialiable on PyPI:
python -m pip install pulse-eco
Requires Python version 3.8+.
Documentation
Official pulse.eco REST API documentation can be found on pulse.eco/restapi.
API Reference and User Guide for this package is available on Read the Docs.
Requesting data with a larger time range
The pulse.eco API limits the maximum time span of data you can get from one request. For /dataRaw it is one week, while for /avgData it is one year.
If the time range is larger than the maximum, the pulseeco module creates multiple requests to the API and then joins the data together. Be aware of this.
Warnings instead of errors
This package does not raise errors for invalid input. Instead it prints warning messages for known bad inputs and makes the API call anyway. So expect an HTTPError.
This is because the REST API documentation doesn't cover all possible errors bad inputs. Another reason is because this package is trying to be future proof.
To disable these warnings:
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore')
...
or (disables warnings for other packages that use warnings module as well):
import warnings
warnings.filterwarnings('ignore')
pulseeco command line tool
This package also provides a command line tool.
$ pulseeco --help
usage: pulseeco [-h] [-B BASE_URL] -U USER -P PASSWORD -C CITY {sensors,sensor,dataRaw,avgData,data24h,current,overall} ...
PulseEco API client
positional arguments:
{sensors,sensor,dataRaw,avgData,data24h,current,overall}
sensors List sensors
sensor Get sensor info by ID
dataRaw Get raw data
avgData Get average data
data24h Get 24h data
current Get current data
overall Get overall data
optional arguments:
-h, --help show this help message and exit
-B BASE_URL, --base-url BASE_URL
PulseEco API base URL
-U USER, --user USER PulseEco API user
-P PASSWORD, --password PASSWORD
PulseEco API password
-C CITY, --city CITY the city name
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.
Source Distribution
Built Distribution
File details
Details for the file pulse-eco-1.0.0.tar.gz
.
File metadata
- Download URL: pulse-eco-1.0.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e2c6d8916ced5c46dbcec6a215dcdb3c214f0e832f45d84a326f2672d8940a7 |
|
MD5 | 017aba3b27c5092ce0e57b6764782245 |
|
BLAKE2b-256 | f6d78f2f45c00887dfc483d81c259041511f7d92fc2bf575079ad297a5781040 |
File details
Details for the file pulse_eco-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pulse_eco-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d95f28c3cc2d7070216cc394eb3a32f1f104cdc8a59cf32238d350450be879f |
|
MD5 | 2a6ecaf32f8d042accfdc3f419db4db4 |
|
BLAKE2b-256 | e45f349a170162a73828767a404e5fd6f21893e020f00bcfe5078773abe9b37a |