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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ebf6c4ba0db12ab0815dc9feb1bf88bd4f8297c7cebe2500f9c52078079a239 |
|
MD5 | 1f746b545059b70455e7f021ca8dccc8 |
|
BLAKE2b-256 | b930ff3b1b32004a537dab0c1ac19e3fb354f73e3007baf4033cee5de88f90df |
Close
Hashes for smartcitizen_connector-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1df0d2b46fb1ae8611c6bfaf9dd23434a11c02b4e77bf0b01c8b95327b918e36 |
|
MD5 | d751cefe164a1a3033fbaa626d495498 |
|
BLAKE2b-256 | 1f30d376c57a16a2cd4c3c3521921a7d8840657a67110c0424479045d181c0db |