diff options
author | CoprDistGit <infra@openeuler.org> | 2023-03-09 16:08:04 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-03-09 16:08:04 +0000 |
commit | c62c54bb28d83234d1780219155d87663bc3812f (patch) | |
tree | de3217edd1a575eaaf0c9908c04d15faa16b163a | |
parent | 9aa995da8306136e09fad09ee4a6c982f80133b4 (diff) |
automatic import of python-pytile
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pytile.spec | 661 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 663 insertions, 0 deletions
@@ -0,0 +1 @@ +/pytile-2022.10.0.tar.gz diff --git a/python-pytile.spec b/python-pytile.spec new file mode 100644 index 0000000..b4512dd --- /dev/null +++ b/python-pytile.spec @@ -0,0 +1,661 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pytile +Version: 2022.10.0 +Release: 1 +Summary: A simple Python API for Tile® Bluetooth trackers +License: MIT +URL: https://github.com/bachya/pytile +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/24/09/358009ab15e870a21c9ab933b2fd054cdf211af6cb73c731b2adf7109821/pytile-2022.10.0.tar.gz +BuildArch: noarch + +Requires: python3-aiohttp + +%description +# 📡 pytile: A simple Python API for Tile® Bluetooth trackers + +[](https://github.com/bachya/pytile/actions) +[](https://pypi.python.org/pypi/pytile) +[](https://pypi.python.org/pypi/pytile) +[](https://github.com/bachya/pytile/blob/main/LICENSE) +[](https://codecov.io/gh/bachya/pytile) +[](https://codeclimate.com/github/bachya/pytile/maintainability) +[](https://saythanks.io/to/bachya) + +<a href="https://www.buymeacoffee.com/bachya1208P" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a> + +`pytile` is a simple Python library for retrieving information on +[Tile® Bluetooth trackers](https://www.thetileapp.com/en-us/) (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](#python-versions) +- [Installation](#installation) +- [Usage](#usage) +- [Contributing](#contributing) + +# 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.9 +- Python 3.10 +- Python 3.11 + +# Installation + +```bash +pip install pytile +``` + +# Usage + +## Getting an API Object + +`pytile` usage starts with an [`aiohttp`](https://github.com/aio-libs/aiohttp) `ClientSession` – +note that this ClientSession is required to properly authenticate the library: + +```python +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: + +```python +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 + +```python +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 Tile +- `altitude`: the altitude of the Tile +- `archetype`: the internal reference string that describes the Tile's "family" +- `dead`: whether the Tile is inactive +- `firmware_version`: the Tile's firmware version +- `hardware_version`: the Tile's hardware version +- `kind`: the kind of Tile (e.g., `TILE`, `PHONE`) +- `last_timestamp`: the timestamp at which the current attributes were received +- `latitude`: the latitude of the Tile +- `longitude`: the latitude of the Tile +- `lost`: 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 Tile +- `uuid`: the Tile UUID +- `visible`: whether the Tile is visible in the mobile app + +```python +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: + +```python +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()) +``` + +# Contributing + +1. [Check for open features/bugs](https://github.com/bachya/pytile/issues) + or [initiate a discussion on one](https://github.com/bachya/pytile/issues/new). +2. [Fork the repository](https://github.com/bachya/pytile/fork). +3. (_optional, but highly recommended_) Create a virtual environment: `python3 -m venv .venv` +4. (_optional, but highly recommended_) Enter the virtual environment: `source ./.venv/bin/activate` +5. Install the dev environment: `script/setup` +6. Code your new feature or bug fix. +7. Write tests that cover your new functionality. +8. Run tests and ensure 100% code coverage: `poetry run pytest --cov pytile tests` +9. Update `README.md` with any new documentation. +10. Add yourself to `AUTHORS.md`. +11. Submit a pull request! + + +%package -n python3-pytile +Summary: A simple Python API for Tile® Bluetooth trackers +Provides: python-pytile +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pytile +# 📡 pytile: A simple Python API for Tile® Bluetooth trackers + +[](https://github.com/bachya/pytile/actions) +[](https://pypi.python.org/pypi/pytile) +[](https://pypi.python.org/pypi/pytile) +[](https://github.com/bachya/pytile/blob/main/LICENSE) +[](https://codecov.io/gh/bachya/pytile) +[](https://codeclimate.com/github/bachya/pytile/maintainability) +[](https://saythanks.io/to/bachya) + +<a href="https://www.buymeacoffee.com/bachya1208P" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a> + +`pytile` is a simple Python library for retrieving information on +[Tile® Bluetooth trackers](https://www.thetileapp.com/en-us/) (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](#python-versions) +- [Installation](#installation) +- [Usage](#usage) +- [Contributing](#contributing) + +# 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.9 +- Python 3.10 +- Python 3.11 + +# Installation + +```bash +pip install pytile +``` + +# Usage + +## Getting an API Object + +`pytile` usage starts with an [`aiohttp`](https://github.com/aio-libs/aiohttp) `ClientSession` – +note that this ClientSession is required to properly authenticate the library: + +```python +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: + +```python +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 + +```python +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 Tile +- `altitude`: the altitude of the Tile +- `archetype`: the internal reference string that describes the Tile's "family" +- `dead`: whether the Tile is inactive +- `firmware_version`: the Tile's firmware version +- `hardware_version`: the Tile's hardware version +- `kind`: the kind of Tile (e.g., `TILE`, `PHONE`) +- `last_timestamp`: the timestamp at which the current attributes were received +- `latitude`: the latitude of the Tile +- `longitude`: the latitude of the Tile +- `lost`: 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 Tile +- `uuid`: the Tile UUID +- `visible`: whether the Tile is visible in the mobile app + +```python +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: + +```python +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()) +``` + +# Contributing + +1. [Check for open features/bugs](https://github.com/bachya/pytile/issues) + or [initiate a discussion on one](https://github.com/bachya/pytile/issues/new). +2. [Fork the repository](https://github.com/bachya/pytile/fork). +3. (_optional, but highly recommended_) Create a virtual environment: `python3 -m venv .venv` +4. (_optional, but highly recommended_) Enter the virtual environment: `source ./.venv/bin/activate` +5. Install the dev environment: `script/setup` +6. Code your new feature or bug fix. +7. Write tests that cover your new functionality. +8. Run tests and ensure 100% code coverage: `poetry run pytest --cov pytile tests` +9. Update `README.md` with any new documentation. +10. Add yourself to `AUTHORS.md`. +11. Submit a pull request! + + +%package help +Summary: Development documents and examples for pytile +Provides: python3-pytile-doc +%description help +# 📡 pytile: A simple Python API for Tile® Bluetooth trackers + +[](https://github.com/bachya/pytile/actions) +[](https://pypi.python.org/pypi/pytile) +[](https://pypi.python.org/pypi/pytile) +[](https://github.com/bachya/pytile/blob/main/LICENSE) +[](https://codecov.io/gh/bachya/pytile) +[](https://codeclimate.com/github/bachya/pytile/maintainability) +[](https://saythanks.io/to/bachya) + +<a href="https://www.buymeacoffee.com/bachya1208P" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a> + +`pytile` is a simple Python library for retrieving information on +[Tile® Bluetooth trackers](https://www.thetileapp.com/en-us/) (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](#python-versions) +- [Installation](#installation) +- [Usage](#usage) +- [Contributing](#contributing) + +# 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.9 +- Python 3.10 +- Python 3.11 + +# Installation + +```bash +pip install pytile +``` + +# Usage + +## Getting an API Object + +`pytile` usage starts with an [`aiohttp`](https://github.com/aio-libs/aiohttp) `ClientSession` – +note that this ClientSession is required to properly authenticate the library: + +```python +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: + +```python +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 + +```python +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 Tile +- `altitude`: the altitude of the Tile +- `archetype`: the internal reference string that describes the Tile's "family" +- `dead`: whether the Tile is inactive +- `firmware_version`: the Tile's firmware version +- `hardware_version`: the Tile's hardware version +- `kind`: the kind of Tile (e.g., `TILE`, `PHONE`) +- `last_timestamp`: the timestamp at which the current attributes were received +- `latitude`: the latitude of the Tile +- `longitude`: the latitude of the Tile +- `lost`: 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 Tile +- `uuid`: the Tile UUID +- `visible`: whether the Tile is visible in the mobile app + +```python +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: + +```python +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()) +``` + +# Contributing + +1. [Check for open features/bugs](https://github.com/bachya/pytile/issues) + or [initiate a discussion on one](https://github.com/bachya/pytile/issues/new). +2. [Fork the repository](https://github.com/bachya/pytile/fork). +3. (_optional, but highly recommended_) Create a virtual environment: `python3 -m venv .venv` +4. (_optional, but highly recommended_) Enter the virtual environment: `source ./.venv/bin/activate` +5. Install the dev environment: `script/setup` +6. Code your new feature or bug fix. +7. Write tests that cover your new functionality. +8. Run tests and ensure 100% code coverage: `poetry run pytest --cov pytile tests` +9. Update `README.md` with any new documentation. +10. Add yourself to `AUTHORS.md`. +11. Submit a pull request! + + +%prep +%autosetup -n pytile-2022.10.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pytile -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu Mar 09 2023 Python_Bot <Python_Bot@openeuler.org> - 2022.10.0-1 +- Package Spec generated @@ -0,0 +1 @@ +d2194cd529c158ca64ccb0d0ec17c793 pytile-2022.10.0.tar.gz |