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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33a70b406df08798ac321202bcaf252114ee898a15e1235ddb2d92553a450311 |
|
MD5 | 8355213a5a7ce15b1869cb656ead9508 |
|
BLAKE2b-256 | 11fff41d81850fa4a0d3981ab8641e68decfeb679b8b0a24ec4ac54f835995e1 |
Close
Hashes for smartcitizen_connector-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b7df6f81ec9927217b98f9f637e962790f82abb34ad48b558716f86bb100a2c |
|
MD5 | df847449b28e3f16cd6cc2c944a9382d |
|
BLAKE2b-256 | 42cdf8334475fb02208b8fc3cbb59d6ca516c4a33d8a93626eff5e577a18c5b1 |