Metadata-Version: 2.1
Name: aioweenect
Version: 1.1.1
Summary: Asynchronous Python client for the weenect API
Home-page: http://github.com/eifinger/aioweenect
License: MIT
Keywords: aiohttp,asyncio,weenect,weenect-api
Author: Kevin Stillhammer
Author-email: kevin.stillhammer@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Project-URL: Repository, http://github.com/eifinger/aioweenect
Description-Content-Type: text/markdown

# 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 = "<YOUR_USER>"
PASSWORD = "<YOUR_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())
```

