<h1 align="center"><i>✨ qingping_sdk ✨ </i></h1>
[![pypi](https://img.shields.io/pypi/v/qingping_sdk.svg)](https://pypi.org/project/qingping_sdk/)
![python](https://img.shields.io/pypi/pyversions/qingping_sdk)
![implementation](https://img.shields.io/pypi/implementation/qingping_sdk)
![wheel](https://img.shields.io/pypi/wheel/qingping_sdk)
![license](https://img.shields.io/github/license/synodriver/qingping_sdk.svg)
![action](https://img.shields.io/github/workflow/status/synodriver/qingping_sdk/build%20wheel)
# Usage
```python
import os
import time
from qingping_sdk import Client
async def main():
async with Client(os.getenv("APP_KEY"), os.getenv("APP_SECRET")) as client:
device = await client.get_devices()
print(device)
mac = device["devices"][0]["info"]["mac"]
print(
await client.get_history_data(
mac, int(time.time()) - 3600, int(time.time())
)
)
print(
await client.get_history_events(
mac, int(time.time()) - 3600, int(time.time())
)
)
d = await client.change_settings(
[mac], 60, 60
)
alert = await client.get_alert(mac)
print(alert)
print(await client.delete_alert(mac, [alert["alert_configs"][0]["id"]]))
print("---groups----")
print(await client.get_groups())
print("---sn----")
print(await client.get_device_info([mac], ["sn"]))
asyncio.run(main())
```
# Public functions
```python
class Client:
def __init__(self, app_key: str, app_secret: str, endpoint: str = None, api_endpoint: str = None, client_session: Incomplete | None = None, close_on_exit: bool = True, loop: asyncio.AbstractEventLoop = None, **kw) -> None: ...
async def aclose(self) -> None: ...
async def __aenter__(self): ...
async def __aexit__(self, exc_type, exc_val, exc_tb): ...
async def send_request(self, method: str = 'GET', url: str = None, params: dict = None, json: dict = None): ...
async def bind_device(self, device_token: str, product_id: int, timestamp: int = None) -> Device: ...
async def delete_device(self, mac: list[str], timestamp: int = None): ...
async def get_devices(self, group_id: int = None, offset: int = None, limit: int = None, role: str = None, timestamp: int = None) -> DeviceResponse: ...
async def get_history_data(self, mac: str, start_time: int, end_time: int, timestamp: int = None, offset: int = None, limit: int = None) -> HistoryDataResponse: ...
async def get_history_events(self, mac: str, start_time: int, end_time: int, timestamp: int = None, offset: int = None, limit: int = None) -> HistoryEventResponse: ...
async def change_settings(self, mac: list[str], report_interval: int, collect_interval: int, timestamp: int = None): ...
async def add_alert(self, mac: str, alert_config: AlertConfig, timestamp: int = None): ...
async def get_alert(self, mac: str, timestamp: int = None) -> GetAlertResponse: ...
async def change_alert(self, mac: str, alert_config: AlertConfig, timestamp: int = None): ...
async def delete_alert(self, mac: str, config_id: list[int], timestamp: int = None): ...
async def get_groups(self, timestamp: int = None) -> GetGroupsResponse: ...
async def get_device_info(self, mac_list: list[str], profile: list[str], timestamp: int = None) -> DeviceInfoResponse: ...
@dataclass
class Event:
sop: bytes
cmd: int
length: int
payload: bytes
checksum: int
@property
def keys(self) -> dict: ...
@keys.setter
def keys(self, value) -> None: ...
def to_bytes(self) -> bytes: ...
def __init__(self, sop, cmd, length, payload, checksum) -> None: ...
def parse_history_data(data: bytes): ...
def build_history_data(time: int, internal: int, history: list) -> bytes: ...
class Connection:
def __init__(self) -> None: ...
def feed_data(self, data: bytes) -> Generator[Event, None, None]: ...
def send(self, event: Event) -> bytes: ...
```
Raw data
{
"_id": null,
"home_page": "https://github.com/synodriver/qingping_sdk",
"name": "qingping-sdk",
"maintainer": "v-vinson",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "asyncio, qingping, cleargrass",
"author": "synodriver",
"author_email": "diguohuangjiajinweijun@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6e/cd/a03e6d9e70658c0606f3f7a4b8984faf05f83a53d32975dada6f0bc143ee/qingping_sdk-0.0.2.tar.gz",
"platform": null,
"description": "<h1 align=\"center\"><i>\u2728 qingping_sdk \u2728 </i></h1>\n\n\n[![pypi](https://img.shields.io/pypi/v/qingping_sdk.svg)](https://pypi.org/project/qingping_sdk/)\n![python](https://img.shields.io/pypi/pyversions/qingping_sdk)\n![implementation](https://img.shields.io/pypi/implementation/qingping_sdk)\n![wheel](https://img.shields.io/pypi/wheel/qingping_sdk)\n![license](https://img.shields.io/github/license/synodriver/qingping_sdk.svg)\n![action](https://img.shields.io/github/workflow/status/synodriver/qingping_sdk/build%20wheel)\n\n\n# Usage \n```python\nimport os\nimport time\nfrom qingping_sdk import Client\n\nasync def main():\n async with Client(os.getenv(\"APP_KEY\"), os.getenv(\"APP_SECRET\")) as client:\n device = await client.get_devices()\n print(device)\n mac = device[\"devices\"][0][\"info\"][\"mac\"]\n print(\n await client.get_history_data(\n mac, int(time.time()) - 3600, int(time.time())\n )\n )\n print(\n await client.get_history_events(\n mac, int(time.time()) - 3600, int(time.time())\n )\n )\n d = await client.change_settings(\n [mac], 60, 60\n )\n alert = await client.get_alert(mac)\n print(alert)\n print(await client.delete_alert(mac, [alert[\"alert_configs\"][0][\"id\"]]))\n print(\"---groups----\")\n print(await client.get_groups())\n print(\"---sn----\")\n print(await client.get_device_info([mac], [\"sn\"]))\n\nasyncio.run(main())\n```\n\n# Public functions\n```python\nclass Client:\n\n def __init__(self, app_key: str, app_secret: str, endpoint: str = None, api_endpoint: str = None, client_session: Incomplete | None = None, close_on_exit: bool = True, loop: asyncio.AbstractEventLoop = None, **kw) -> None: ...\n async def aclose(self) -> None: ...\n async def __aenter__(self): ...\n async def __aexit__(self, exc_type, exc_val, exc_tb): ...\n async def send_request(self, method: str = 'GET', url: str = None, params: dict = None, json: dict = None): ...\n async def bind_device(self, device_token: str, product_id: int, timestamp: int = None) -> Device: ...\n async def delete_device(self, mac: list[str], timestamp: int = None): ...\n async def get_devices(self, group_id: int = None, offset: int = None, limit: int = None, role: str = None, timestamp: int = None) -> DeviceResponse: ...\n async def get_history_data(self, mac: str, start_time: int, end_time: int, timestamp: int = None, offset: int = None, limit: int = None) -> HistoryDataResponse: ...\n async def get_history_events(self, mac: str, start_time: int, end_time: int, timestamp: int = None, offset: int = None, limit: int = None) -> HistoryEventResponse: ...\n async def change_settings(self, mac: list[str], report_interval: int, collect_interval: int, timestamp: int = None): ...\n async def add_alert(self, mac: str, alert_config: AlertConfig, timestamp: int = None): ...\n async def get_alert(self, mac: str, timestamp: int = None) -> GetAlertResponse: ...\n async def change_alert(self, mac: str, alert_config: AlertConfig, timestamp: int = None): ...\n async def delete_alert(self, mac: str, config_id: list[int], timestamp: int = None): ...\n async def get_groups(self, timestamp: int = None) -> GetGroupsResponse: ...\n async def get_device_info(self, mac_list: list[str], profile: list[str], timestamp: int = None) -> DeviceInfoResponse: ...\n\n\n@dataclass\nclass Event:\n sop: bytes\n cmd: int\n length: int\n payload: bytes\n checksum: int\n @property\n def keys(self) -> dict: ...\n @keys.setter\n def keys(self, value) -> None: ...\n def to_bytes(self) -> bytes: ...\n def __init__(self, sop, cmd, length, payload, checksum) -> None: ...\n\ndef parse_history_data(data: bytes): ...\ndef build_history_data(time: int, internal: int, history: list) -> bytes: ...\n\nclass Connection:\n def __init__(self) -> None: ...\n def feed_data(self, data: bytes) -> Generator[Event, None, None]: ...\n def send(self, event: Event) -> bytes: ...\n\n```\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "qingping sdk for python in asyncio with binary protocol parser",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/synodriver/qingping_sdk"
},
"split_keywords": [
"asyncio",
" qingping",
" cleargrass"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d2237e435a5df9985e980d74dafe003f5410ead290e80594c1e28e745337a913",
"md5": "55201677a2abfa7cc63eb222da49a914",
"sha256": "244accc0357597751f6b48dcc5fba8146172a5c584448bacdb140283d4050ecb"
},
"downloads": -1,
"filename": "qingping_sdk-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "55201677a2abfa7cc63eb222da49a914",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9536,
"upload_time": "2024-12-30T06:34:04",
"upload_time_iso_8601": "2024-12-30T06:34:04.103555Z",
"url": "https://files.pythonhosted.org/packages/d2/23/7e435a5df9985e980d74dafe003f5410ead290e80594c1e28e745337a913/qingping_sdk-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6ecda03e6d9e70658c0606f3f7a4b8984faf05f83a53d32975dada6f0bc143ee",
"md5": "07182ed24fff12122fb8b367ffb65024",
"sha256": "9e92b97eb4adb2bff9fd0d8a139f5c171dce4138692d6b4a2cce53f879701f89"
},
"downloads": -1,
"filename": "qingping_sdk-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "07182ed24fff12122fb8b367ffb65024",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9811,
"upload_time": "2024-12-30T06:34:07",
"upload_time_iso_8601": "2024-12-30T06:34:07.247239Z",
"url": "https://files.pythonhosted.org/packages/6e/cd/a03e6d9e70658c0606f3f7a4b8984faf05f83a53d32975dada6f0bc143ee/qingping_sdk-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-30 06:34:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "synodriver",
"github_project": "qingping_sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": []
},
{
"name": "crcmod-plus",
"specs": []
}
],
"lcname": "qingping-sdk"
}