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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98a6e51f369f38b4f5709ffd26946f2c19b863d7f3b2870ba0d461d99d0a9062 |
|
MD5 | 506f315b7123beacdcef634bfe25ef90 |
|
BLAKE2b-256 | 93f0f6e5278e330d6e8a67be6fcef9a5953228ba9370a02d563e2706767809ef |
Close
Hashes for smartcitizen_connector-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21f277fdecde02a3e1b8d341606b2eeba04c85698d4019551be0e34b74685072 |
|
MD5 | 0cdb7232b34a55574e4018bcf02dbef7 |
|
BLAKE2b-256 | f318c91aed2613a83a3a48b3027d77181752f5034c8162f1ae6d8196b7dfe959 |