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
File details
Details for the file smartcitizen_connector-1.2.0.tar.gz
.
File metadata
- Download URL: smartcitizen_connector-1.2.0.tar.gz
- Upload date:
- Size: 29.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66a1b6577deefcefebd98c64d247c75476ee15a9e38cce8d3b5d4fe885883bdc |
|
MD5 | 06e1035986c3969609efd322bc8bd0bd |
|
BLAKE2b-256 | 5453aa8be21990fc1f2614935dd4180aed35a93db1d04e7eda67e825e732b8a6 |
File details
Details for the file smartcitizen_connector-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: smartcitizen_connector-1.2.0-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73172628980306072eae4401ae5d4122f189ad4cb91051004e1f44c75b676fa2 |
|
MD5 | d58644ffe83ba695e9f5d5b18ffbc31c |
|
BLAKE2b-256 | 68631dd20e03480296f53b04437784940b1295cec0d5c9c97b68a3cfa8aa4bc5 |