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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | edbb2da49b55545208a7e6e1f4cc6d0a82ffb023544b7fb89c3f45b255e27387 |
|
MD5 | f141872beca374c10d453d6cdda51e0e |
|
BLAKE2b-256 | 884ec2a20b9dd081e086663a59103148dd899671719b3790fba5b1c55da9769f |
Close
Hashes for smartcitizen_connector-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88d221a1393bee99310305fdb6e405970e1253def178d2717637d3960a0a0bae |
|
MD5 | c88395f0746cd496b0bdc6a3e207f9c8 |
|
BLAKE2b-256 | b374c13a7b2d7c770e8506ccd668606fd8e2e93eb649f41af59d7d1a25e90189 |