Package: pytile
📡 pytile: A simple Python API for Tile® Bluetooth trackerspytileis a simple Python library for retrieving information onTile® 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 VersionsInstallationUsageContributingNOTE: Version 5.0.0Version 5.0.0 is a complete re-architecture ofpytile– as such, the API has changed.
Please read the documentation carefully!Python Versionspytileis currently supported on:Python 3.10Python 3.11Python 3.12InstallationpipinstallpytileUsageGetting an API Objectpytileusage starts with anaiohttpClientSession– note that this
ClientSession is required to properly authenticate the library:importasynciofromaiohttpimportClientSessionfrompytileimportasync_loginasyncdefmain()->None:"""Run!"""asyncwithClientSession()assession:api=awaitasync_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:importasynciofromaiohttpimportClientSessionfrompytileimportasync_loginasyncdefmain()->None:"""Run!"""asyncwithClientSession()assession:api=awaitasync_login("<EMAIL>","<PASSWORD>",session,client_uuid="MY_UUID",locale="en-GB")asyncio.run(main())Getting TilesTile Premium Required: NoimportasynciofromaiohttpimportClientSessionfrompytileimportasync_loginasyncdefmain()->None:"""Run!"""asyncwithClientSession()assession:api=awaitasync_login("<EMAIL>","<PASSWORD>",session)tiles=awaitapi.async_get_tiles()asyncio.run(main())Theasync_get_tilescoroutine returns a dict with Tile UUIDs as the keys andTileobjects as the values.TheTileObjectThe 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 appimportasynciofromaiohttpimportClientSessionfrompytileimportasync_loginasyncdefmain()->None:"""Run!"""asyncwithClientSession()assession:api=awaitasync_login("<EMAIL>","<PASSWORD>",session)tiles=awaitapi.async_get_tiles()fortile_uuid,tileintiles.items():print(f"The Tile's name is{tile.name}")# ...asyncio.run(main())In addition to these properties, theTileobject comes with anasync_updatecoroutine
which requests new data from the Tile cloud API for this Tile:importasynciofromaiohttpimportClientSessionfrompytileimportasync_loginasyncdefmain()->None:"""Run!"""asyncwithClientSession()assession:api=awaitasync_login("<EMAIL>","<PASSWORD>",session)tiles=awaitapi.async_get_tiles()fortile_uuid,tileintiles.items():awaittile.async_update()asyncio.run(main())Getting Premium Tile's HistoryTile Premium Required: YesYou can retrieve a Tile's history by calling itsasync_historycoroutine:importasynciofromdatetimeimportdatetimefromaiohttpimportClientSessionfrompytileimportasync_loginasyncdefmain()->None:"""Run!"""asyncwithClientSession()assession:api=awaitasync_login("<EMAIL>","<PASSWORD>",session)tiles=awaitapi.async_get_tiles()fortile_uuid,tileintiles.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=awaittile.async_history(start,end)# >>> { "version": 1, "revision": 1, ... }asyncio.run(main())ContributingThanks to all ofour contributorsso far!Check for open features/bugsorinitiate 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/activateInstall the dev environment:script/setupCode 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 testsUpdateREADME.mdwith any new documentation.Submit a pull request!