An open API service indexing awesome lists of open source software.

https://github.com/eifinger/aioweenect

Asynchronous Python client for the weenect API
https://github.com/eifinger/aioweenect

aiohttp python python3 weenect weenect-api

Last synced: 28 days ago
JSON representation

Asynchronous Python client for the weenect API

Awesome Lists containing this project

README

        

# aioweenect

Asynchronous Python client for the weenect API

[![GitHub Actions](https://github.com/eifinger/aioweenect/workflows/CI/badge.svg)](https://github.com/eifinger/aioweenect/actions?workflow=CI)
[![PyPi](https://img.shields.io/pypi/v/aioweenect.svg)](https://pypi.python.org/pypi/aioweenect)
[![PyPi](https://img.shields.io/pypi/l/aioweenect.svg)](https://github.com/eifinger/aioweenect/blob/master/LICENSE)
[![codecov](https://codecov.io/gh/eifinger/aioweenect/branch/master/graph/badge.svg)](https://codecov.io/gh/eifinger/aioweenect)
[![Downloads](https://pepy.tech/badge/aioweenect)](https://pepy.tech/project/aioweenect)

## Installation

```bash
$ pip install aioweenect
```

## Usage

```python
from aioweenect import AioWeenect

import asyncio

USER = ""
PASSWORD = ""

async def main():
"""Show example how to get location of your tracker."""
async with AioWeenect(username=USER, password=PASSWORD) as aioweenect:
trackers_response = await aioweenect.get_trackers()
tracker_id = trackers_response["items"][0]["id"]
tracker_name = trackers_response["items"][0]["name"]

position_response = await aioweenect.get_position(tracker_id=tracker_id)
lat = position_response[0]["latitude"]
lon = position_response[0]["longitude"]
last_message = position_response[0]["last_message"]
print(
f"Location for {tracker_name}: lat: {lat}, lon: {lon}. Last message received: {last_message}"
)

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```