Python connector to download information collected in SmartCitizen API
Project description
Smart Citizen Connector
This is a connector written in python
to get and post data from the Smart Citizen API. It can be used in conjunction with other scripts such as scdata.
Installation
Simply do:
pip install smartcitizen-connector
Development
Or clone the repo and install in editable mode:
git clone git@github.com:fablabbcn/smartcitizen-connector.git
cd smartcitizen-connector
pip install -e .
Usage
Device (create and get data - blazingly fast!):
from smartcitizen_connector import SCDevice
import asyncio
d = SCDevice(16549)
print (d.json.name)
print (d.json.owner)
await d.get_data(freq = '1Min') # returns pandas dataframe
print (d.data)
Search (see docs)
from smartcitizen_connector import search_by_query
# Users whose username contains "osc"
search_by_query(endpoint = 'users', key="username", search_matcher="cont", value="osc")
# Devices in which
search_by_query(endpoint = 'devices', key="name", search_matcher="cont", value="air")
# Devices created after (date greater than) "2023-08-11"
search_by_query(endpoint = 'devices', key="created_at", search_matcher="gt", value="2023-08-11")
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
Close
Hashes for smartcitizen_connector-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27499c956e4b101fa4f70a67b9d9c3429327174d33a5e74b01fb585fc05c5905 |
|
MD5 | 630c54bd505cce66a073b2787a1f5b00 |
|
BLAKE2b-256 | 99c69a1b602ebeb72c9028210c7dd0afc6c478563e5de859703b7565d08bda59 |
Close
Hashes for smartcitizen_connector-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b081cb09f04d5207ec22fe8e174c3388483e6cdd964e0ecc553f6627eebea025 |
|
MD5 | 07d77a4a86a9d4e1a4ac780490650583 |
|
BLAKE2b-256 | b846f1bdf72109608434e9b21856df6c2c7a83a648f5c55820423a5ff68005ff |