A simple Python API for Tile® Bluetooth trackers
Project description
📡 pytile: A simple Python API for Tile® Bluetooth trackers
pytile
is a simple Python library for retrieving information on
Tile® Bluetooth trackers (including last
location and more).
This library is built on an unpublished, unofficial Tile API; it may alter or cease operation at any point.
Python Versions
pytile
is currently supported on:
- Python 3.6
- Python 3.7
- Python 3.8
Installation
pip install pytile
Usage
pytile
starts within an
aiohttp ClientSession
:
import asyncio
from aiohttp import ClientSession
from pytile import Client
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
# YOUR CODE HERE
asyncio.get_event_loop().run_until_complete(main())
If you receive SSL errors, use ClientSession(connector=TCPConnector(verify_ssl=False))
instead:
import asyncio
from aiohttp import ClientSession, TCPConnector
from pytile import Client
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession(connector=TCPConnector(verify_ssl=False)) as websession:
# YOUR CODE HERE
asyncio.get_event_loop().run_until_complete(main())
Create a client, initialize it, and get to work:
import asyncio
from aiohttp import ClientSession
from pytile import async_login
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
client = await async_login("<EMAIL>", "<PASSWORD>", websession)
# Get all Tiles associated with an account:
await client.tiles.all()
asyncio.get_event_loop().run_until_complete(main())
If for some reason you need to use a specific client UUID (to, say, ensure that the Tile API sees you as a client it's seen before) or a specific locale, you can do so easily:
import asyncio
from aiohttp import ClientSession
from pytile import async_login
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
client = await async_login(
"<EMAIL>", "<PASSWORD>", websession, client_uuid="MY_UUID", locale="en-GB"
)
# Get all Tiles associated with an account:
await client.tiles.all()
asyncio.get_event_loop().run_until_complete(main())
Contributing
- Check for open features/bugs or initiate a discussion on one.
- Fork the repository.
- Install the dev environment:
make init
. - Enter the virtual environment:
source .venv/bin/activate
- Code your new feature or bug fix.
- Write a test that covers your new functionality.
- Run tests and ensure 100% code coverage:
make coverage
- Add yourself to
AUTHORS.md
. - Submit a pull request!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.