Skip to main content

Python application

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

Clone the repo and install in editable mode:

git clone git@github.com:fablabbcn/smartcitizen-connector.git
cd smartcitizen-connector
pip install -e .

Usage

See docs for examples. a basic usage is shown below:

  • Device (create and get data):
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)
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")
  • Authentication

Set the following environment variable with your Smart Citizen API token:

SC_BEARER=xxxxx

Metadata

Release files for smartcitizen-connector 1.5.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartcitizen-connector 1.5.8
File Size Uploaded Provenance Actions
smartcitizen_connector-1.5.8.tar.gz 34.2 kB Without provenance Details for smartcitizen_connector-1.5.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smartcitizen-connector 1.5.8
File Interpreter ABI Platform Actions
smartcitizen_connector-1.5.8-py3-none-any.whl Python 3 none any Details for smartcitizen_connector-1.5.8-py3-none-any.whl

Total release size: 73.0 kB

Release files / smartcitizen_connector-1.5.8.tar.gz

Download URL smartcitizen_connector-1.5.8.tar.gz
Size 34.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f45d64e53cd905431124d99db84166320b7d4671e37b0977be6a8a74fb6ac84f
BLAKE2b-256 checksum
How to use checksums
7a7747846e39edb2a72fbf48f2e13b0d61ecb1e28614717f9bdc7258cb1cd873
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / smartcitizen_connector-1.5.8-py3-none-any.whl

Download URL smartcitizen_connector-1.5.8-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
906a7ff74076bd074bb6f041ab4502f08cf5f8858c3f0b5899e74c182a6761f6
BLAKE2b-256 checksum
How to use checksums
22bf913a22efd1e0079d97b829067186c55840f72e4e566e723dcc2c98264e05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for smartcitizen-connector 1.5.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.8 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page