📡 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.
NOTE: Version 5.0.0
Version 5.0.0 is a complete re-architecture of pytile – as such, the API has changed.
Please read the documentation carefully!
Python Versions
pytile is currently supported on:
- Python 3.10
- Python 3.11
- Python 3.12
Installation
pip install pytile
Usage
Getting an API Object
pytile usage starts with an aiohttp ClientSession – note that this
ClientSession is required to properly authenticate the library:
import asyncio
from aiohttp import ClientSession
from pytile import async_login
async def main() -> None:
"""Run!"""
async with ClientSession() as session:
api = await async_login("<EMAIL>", "<PASSWORD>", session)
asyncio.run(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:
"""Run!"""
async with ClientSession() as session:
api = await async_login(
"<EMAIL>", "<PASSWORD>", session, client_uuid="MY_UUID", locale="en-GB"
)
asyncio.run(main())
Getting Tiles
Tile Premium Required: No
import asyncio
from aiohttp import ClientSession
from pytile import async_login
async def main() -> None:
"""Run!"""
async with ClientSession() as session:
api = await async_login("<EMAIL>", "<PASSWORD>", session)
tiles = await api.async_get_tiles()
asyncio.run(main())
The async_get_tiles coroutine returns a dict with Tile UUIDs as the keys and Tile
objects as the values.
The Tile Object
The Tile object comes with several properties:
accuracy: the location accuracy of the Tilealtitude: the altitude of the Tilearchetype: the internal reference string that describes the Tile's "family"dead: whether the Tile is inactivefirmware_version: the Tile's firmware versionhardware_version: the Tile's hardware versionkind: the kind of Tile (e.g.,TILE,PHONE)last_timestamp: the timestamp at which the current attributes were receivedlatitude: the latitude of the Tilelongitude: the latitude of the Tilelost: whether the Tile has been marked as "lost"lost_timestamp: the timestamp at which the Tile was last marked as "lost"name: the name of the Tileuuid: the Tile UUIDvisible: whether the Tile is visible in the mobile app
import asyncio
from aiohttp import ClientSession
from pytile import async_login
async def main() -> None:
"""Run!"""
async with ClientSession() as session:
api = await async_login("<EMAIL>", "<PASSWORD>", session)
tiles = await api.async_get_tiles()
for tile_uuid, tile in tiles.items():
print(f"The Tile's name is {tile.name}")
# ...
asyncio.run(main())
In addition to these properties, the Tile object comes with an async_update coroutine
which requests new data from the Tile cloud API for this Tile:
import asyncio
from aiohttp import ClientSession
from pytile import async_login
async def main() -> None:
"""Run!"""
async with ClientSession() as session:
api = await async_login("<EMAIL>", "<PASSWORD>", session)
tiles = await api.async_get_tiles()
for tile_uuid, tile in tiles.items():
await tile.async_update()
asyncio.run(main())
Getting Premium Tile's History
Tile Premium Required: Yes
You can retrieve a Tile's history by calling its async_history coroutine:
import asyncio
from datetime import datetime
from aiohttp import ClientSession
from pytile import async_login
async def main() -> None:
"""Run!"""
async with ClientSession() as session:
api = await async_login("<EMAIL>", "<PASSWORD>", session)
tiles = await api.async_get_tiles()
for tile_uuid, tile in tiles.items():
# Define a start and end datetime to get history for:
start = datetime(2023, 1, 1, 0, 0, 0)
end = datetime(2023, 1, 31, 0, 0, 0)
history = await tile.async_history(start, end)
# >>> { "version": 1, "revision": 1, ... }
asyncio.run(main())
Contributing
Thanks to all of our contributors so far!
- Check for open features/bugs or initiate a discussion on one.
- Fork the repository.
- (optional, but highly recommended) Create a virtual environment:
python3 -m venv .venv - (optional, but highly recommended) Enter the virtual environment:
source ./.venv/bin/activate - Install the dev environment:
script/setup - Code your new feature or bug fix on a new branch.
- Write tests that cover your new functionality.
- Run tests and ensure 100% code coverage:
poetry run pytest --cov pytile tests - Update
README.mdwith any new documentation. - Submit a pull request!
Metadata
Release files for pytile 2024.12.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pytile-2024.12.0.tar.gz | 10.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytile-2024.12.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.4 kB
Release files / pytile-2024.12.0.tar.gz
| Download URL | pytile-2024.12.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3cdc41f5ed89d71b8541176d7a776ce286dc72da5abdeb04e46ee86ff4a1216
|
|
BLAKE2b-256 checksum How to use checksums |
b2aa26b59f487a31b88ffbc202f5675d21aa7967efa275e9233280fe20f5fd57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
|
Release files / pytile-2024.12.0-py3-none-any.whl
| Download URL | pytile-2024.12.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe38baa00cbf449f72f64d699a9bf6d050d3a830ed1073c9355999ace4739664
|
|
BLAKE2b-256 checksum How to use checksums |
988a69a49000054c413fca808573527bdd878ccefe59e8e0bedf78314b0ad7c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
|
Security for pytile 2024.12.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.