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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e6f82ebd4997d837d56a3fea729d9920fd0a2ded37c4ba9805cb238c3f44ce8 |
|
MD5 | 911205db75560102224dd6b134e7951f |
|
BLAKE2b-256 | c4b974450a14f28fcad5e3ed13cab98354752a31f0990277d97e494cdb4d7cdf |
Close
Hashes for smartcitizen_connector-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6133db254c3502dfe133b24dc1fbcc4968f3fc20da281305a0b3cabbd7840198 |
|
MD5 | 5d94abb8b6efa517bd4b12249c29c74e |
|
BLAKE2b-256 | 27dcc6337cff2ff9f7535aa4f585fa306e1c52acabcc6a72483c7f2bfca3cf92 |