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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1a1be7b0342bea19a41a72d06e49adb1db9ed694fb84ff37b08f8270889da4f |
|
MD5 | 60d7d91ef404de557a3d1bde204f963e |
|
BLAKE2b-256 | 023e6a16bd7d198e595e4e50d60394f82350746ea45d61c4ff1acbe680697659 |
Close
Hashes for smartcitizen_connector-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e57cc398b32182240f3ecc63b4d3c2fdefebb8debcb2070ec4c8ae7c05f7e9b |
|
MD5 | 2bac9e4145cf2a63e08bc1ed562ec411 |
|
BLAKE2b-256 | 17dbb175053616af8380a881cc6c618d1505139ead653632f60d4149bf600541 |