[![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.6",
"maintainer_email": null,
"keywords": "sensors, Smart Citizen",
"author": "oscgonfer",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/68/9f/42908a036fbdea72a7de9e1502d3ae942d3df638e1a7d652fa7d65bbccd1/smartcitizen_connector-1.0.4.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.0.4",
"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": "23d0f3ebdffb6499f807ca2bad53732346c1da4575633e4eaad923df46183ce2",
"md5": "77b6f4869783b9b8867c988ece51b67c",
"sha256": "8a31a8823c71ec5bda6c6e7582b450b15c2721abc1347e98a7b9b5469e36b748"
},
"downloads": -1,
"filename": "smartcitizen_connector-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "77b6f4869783b9b8867c988ece51b67c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 30768,
"upload_time": "2024-05-02T14:44:08",
"upload_time_iso_8601": "2024-05-02T14:44:08.604384Z",
"url": "https://files.pythonhosted.org/packages/23/d0/f3ebdffb6499f807ca2bad53732346c1da4575633e4eaad923df46183ce2/smartcitizen_connector-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "689f42908a036fbdea72a7de9e1502d3ae942d3df638e1a7d652fa7d65bbccd1",
"md5": "fd050c4ec8e674a74fe823095de55a22",
"sha256": "4afecd59c489f3bcd759fc5873d607dcdf719a8de607f6f7d012da522029c36c"
},
"downloads": -1,
"filename": "smartcitizen_connector-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "fd050c4ec8e674a74fe823095de55a22",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 27990,
"upload_time": "2024-05-02T14:44:10",
"upload_time_iso_8601": "2024-05-02T14:44:10.571717Z",
"url": "https://files.pythonhosted.org/packages/68/9f/42908a036fbdea72a7de9e1502d3ae942d3df638e1a7d652fa7d65bbccd1/smartcitizen_connector-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-02 14:44:10",
"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"
}