[![Python application](https://github.com/fablabbcn/smartcitizen-connector/actions/workflows/python-app.yml/badge.svg)](https://github.com/fablabbcn/smartcitizen-connector/actions/workflows/python-app.yml)
# 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](https://github.com/fablabbcn/smartcitizen-data).
## 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](https://developer.smartcitizen.me/#basic-searching))
```
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")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/fablabbcn/smartcitizen-connector",
"name": "smartcitizen-connector",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "sensors, Smart Citizen",
"author": "oscgonfer",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/32/d3/d53fc34e4819b044c49ab7fd40b6f75fede03f5c60937ed30cf8f6fce8fa/smartcitizen_connector-1.3.0.tar.gz",
"platform": null,
"description": "[![Python application](https://github.com/fablabbcn/smartcitizen-connector/actions/workflows/python-app.yml/badge.svg)](https://github.com/fablabbcn/smartcitizen-connector/actions/workflows/python-app.yml)\n\n# Smart Citizen Connector\n\nThis 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](https://github.com/fablabbcn/smartcitizen-data).\n\n## Installation\n\nSimply do:\n\n```\npip install smartcitizen-connector\n```\n\n### Development\n\nOr clone the repo and install in editable mode:\n\n```\ngit clone git@github.com:fablabbcn/smartcitizen-connector.git\ncd smartcitizen-connector\npip install -e .\n```\n\n## Usage\n\nDevice (create and get data - blazingly fast!):\n\n```\nfrom smartcitizen_connector import SCDevice\nimport asyncio\n\nd = SCDevice(16549)\nprint (d.json.name)\nprint (d.json.owner)\n\nawait d.get_data(freq = '1Min') # returns pandas dataframe\nprint (d.data)\n```\n\nSearch (see [docs](https://developer.smartcitizen.me/#basic-searching))\n\n```\nfrom smartcitizen_connector import search_by_query\n# Users whose username contains \"osc\"\nsearch_by_query(endpoint = 'users', key=\"username\", search_matcher=\"cont\", value=\"osc\")\n# Devices in which\nsearch_by_query(endpoint = 'devices', key=\"name\", search_matcher=\"cont\", value=\"air\")\n# Devices created after (date greater than) \"2023-08-11\"\nsearch_by_query(endpoint = 'devices', key=\"created_at\", search_matcher=\"gt\", value=\"2023-08-11\")\n```\n",
"bugtrack_url": null,
"license": "GNU General Public License v3",
"summary": "Python connector to download information collected in SmartCitizen API",
"version": "1.3.0",
"project_urls": {
"Documentation": "https://docs.smartcitizen.me/",
"Homepage": "https://github.com/fablabbcn/smartcitizen-connector",
"Source Code": "https://github.com/fablabbcn/smartcitizen-connector"
},
"split_keywords": [
"sensors",
" smart citizen"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d7c244863fbe85b6fe7cbf01f88b3478d1826d640acd45e9f198f6e1c01897ab",
"md5": "c4886c006532009117729f25218c6600",
"sha256": "1e9ae075f0d8c6dd7bf6c6aa0e15514bbf119f3f0f9be4e2163a188b06aba177"
},
"downloads": -1,
"filename": "smartcitizen_connector-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c4886c006532009117729f25218c6600",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 34568,
"upload_time": "2024-11-27T11:46:43",
"upload_time_iso_8601": "2024-11-27T11:46:43.536391Z",
"url": "https://files.pythonhosted.org/packages/d7/c2/44863fbe85b6fe7cbf01f88b3478d1826d640acd45e9f198f6e1c01897ab/smartcitizen_connector-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "32d3d53fc34e4819b044c49ab7fd40b6f75fede03f5c60937ed30cf8f6fce8fa",
"md5": "a52425c7618865a85820f73a7cac0d6d",
"sha256": "61e85b50e0a257f02133da17fe0f53fe7e43a8c975338127d941be3be195c344"
},
"downloads": -1,
"filename": "smartcitizen_connector-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "a52425c7618865a85820f73a7cac0d6d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 29705,
"upload_time": "2024-11-27T11:46:44",
"upload_time_iso_8601": "2024-11-27T11:46:44.847369Z",
"url": "https://files.pythonhosted.org/packages/32/d3/d53fc34e4819b044c49ab7fd40b6f75fede03f5c60937ed30cf8f6fce8fa/smartcitizen_connector-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 11:46:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fablabbcn",
"github_project": "smartcitizen-connector",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "smartcitizen-connector"
}