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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4d66af1fd5a91fef5b6490c97f942dd1ac98ab3e9603c145b11ae66fdc1257b |
|
MD5 | ddcdb4b2605a7e47dff44988135196ac |
|
BLAKE2b-256 | 761a91ece5ba24eec5cec38b0d12b7a84fb7b23f995f312a959818615e735f9e |
Close
Hashes for smartcitizen_connector-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ffdba172042d52809915e3591772db7166b6c24718015802d5116640dd8a39b |
|
MD5 | 3bbbc0fdf8cc98980ad64d35ae013d19 |
|
BLAKE2b-256 | 4412ed7e20d101f55f5a93fc18db66fe65085d9c920aecfb4e50aca82673785e |