diff options
Diffstat (limited to 'python-pyporscheconnectapi.spec')
| -rw-r--r-- | python-pyporscheconnectapi.spec | 478 |
1 files changed, 478 insertions, 0 deletions
diff --git a/python-pyporscheconnectapi.spec b/python-pyporscheconnectapi.spec new file mode 100644 index 0000000..aafd35b --- /dev/null +++ b/python-pyporscheconnectapi.spec @@ -0,0 +1,478 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pyporscheconnectapi +Version: 0.0.26 +Release: 1 +Summary: Python library and CLI for communicating with Porsche Connect API. +License: MIT +URL: https://github.com/cjne/pyporscheconnectapi +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3e/5d/dbf01f03da359ac2a02ab964a214c95bd3f9371b3e7a875459a893b79340/pyporscheconnectapi-0.0.26.tar.gz +BuildArch: noarch + +Requires: python3-aiohttp + +%description +# pyporscheconnectapi +A python library for Porsche Connect API + +This library will let you access your car equipped with Porsche Connect. It does not work with the predecessor Porsche Car Connect. +Porsche Connect is available for the following Porsche models: + +* Taycan +* 911 (from 992) +* Cayenne (from 2017, E3) +* Panamera (from 2021, G2 PA) + +You can also take a look here, select your model and see if your model has support for Porsche Connect: +https://connect-store.porsche.com/ + +A Porsche Connect subscription alse needs to be active for it to work. + +*NOTE:* This work is not officially supported by Porsche and functionality can stop working at any time without warning + +## Installation + +The easiest method is to install using pip3/pip (venv is also a good idea) +``` +pip install pyporscheconnectapi +``` + +to update to the latest version + +``` +pip install pyporscheconnectapi -U +``` + +Setup will add a cli under the name porschecli, see below for usage + + +## CLI usage + +A simple cli is provided with this library, it will cache tokens to a file to speed up invocations. It does not yet support the create/update/delete timer functionality which is present in the library. + +If no email or password is supplied as input arguments and no config file with those details is found you will be prompted. Same goes for PIN (used to lock or unlock). +The --nowait option will just request the action (or stored information) without waiting for confirmation. +``` +usage: cli.py [-h] [-e EMAIL] [-p PASSWORD] [-s SESSION_FILE] [-v VIN] + [-n PIN] [-m MODEL] [-a] [-c COUNTRY] [-l LANGUAGE] + [-z TIMEZONE] [--nowait] + {list,overview,maintenance,summary,capabilities,emobility,position,triplongterm,tripshortterm,speedalerts,theftalerts,tokens,lock,unlock,climate-on,climate-off,directcharge-on,directcharge-off} + +Porsche Connect CLI. + +positional arguments: + {list,overview,maintenance,summary,capabilities,emobility,position,triplongterm,tripshortterm,speedalerts,theftalerts,tokens,lock,unlock,climate-on,climate-off,directcharge-on,directcharge-off} + +optional arguments: + -h, --help show this help message and exit + -e EMAIL, --email EMAIL + -p PASSWORD, --password PASSWORD + -s SESSION_FILE, --sessionfile SESSION_FILE + -v VIN, --vin VIN + -n PIN, --pin PIN + -m MODEL, --model MODEL + -a, --all + -c COUNTRY, --country COUNTRY + -l LANGUAGE, --language LANGUAGE + -z TIMEZONE, --timezone TIMEZONE + --nowait +``` + +## Config file (for CLI) + +A config file is searched for in ~/.porscheconnect.cfg and ./.porscheconnect.cfg +The format is: + +``` +[porsche] +email=<your email> +password=<your password> +country=<country iso code, default DE> +language=<lang abbreviation, default de> +timezone=<default Europe/Stockholm> +``` + +## Library usage + +Install pyporscheconnectapi using pip (requires python > 3.6) + + +### Example client usage +``` +import asyncio +from pyporscheconnectapi.connection import Connection +from pyporscheconnectapi.client import Client +email = ..your porsche connect email... +password = ...your porsche connect password... + +async def vehicles() -> None: + conn = Connection(email, password) + client = Client(conn) + + vehicles = await client.getVehicles() + for vehicle in vehicles: + print(f"VIN: {vehicle['vin']} Model: {vehicle['modelDescription']} Year: {vehicle['modelYear']}") + + await conn.close() + +loop = asyncio.get_event_loop() +loop.run_until_complete(vehicles()) +``` + +### Example connection usage for custom requests +``` +import asyncio +from pyporscheconnectapi.connection import Connection +from pyporscheconnectapi.client import Client +email = ..your porsche connect email... +password = ...your porsche connect password... + +async def vehicles() -> None: + conn = Connection(email, password) + client = Client(conn) + + vehicles = await client.getVehicles() + for vehicle in vehicles: + print(f"VIN: {vehicle['vin']} Model: {vehicle['modelDescription']} Year: {vehicle['modelYear']}") + # Using connection.get will automatically add auth headers + data = await conn.get(f"https://api.porsche.com/core/api/v3/se/sv_SE/vehicles/{vehicle['vin']}") + print(f"Battery at {data['carControlData']['batteryLevel']['value']}%") + + await conn.close() + +loop = asyncio.get_event_loop() +loop.run_until_complete(vehicles()) +``` + + +## Credits +[evcc](https://github.com/andig/evcc) was a good resource for figuring out the Authentication flow + + +%package -n python3-pyporscheconnectapi +Summary: Python library and CLI for communicating with Porsche Connect API. +Provides: python-pyporscheconnectapi +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pyporscheconnectapi +# pyporscheconnectapi +A python library for Porsche Connect API + +This library will let you access your car equipped with Porsche Connect. It does not work with the predecessor Porsche Car Connect. +Porsche Connect is available for the following Porsche models: + +* Taycan +* 911 (from 992) +* Cayenne (from 2017, E3) +* Panamera (from 2021, G2 PA) + +You can also take a look here, select your model and see if your model has support for Porsche Connect: +https://connect-store.porsche.com/ + +A Porsche Connect subscription alse needs to be active for it to work. + +*NOTE:* This work is not officially supported by Porsche and functionality can stop working at any time without warning + +## Installation + +The easiest method is to install using pip3/pip (venv is also a good idea) +``` +pip install pyporscheconnectapi +``` + +to update to the latest version + +``` +pip install pyporscheconnectapi -U +``` + +Setup will add a cli under the name porschecli, see below for usage + + +## CLI usage + +A simple cli is provided with this library, it will cache tokens to a file to speed up invocations. It does not yet support the create/update/delete timer functionality which is present in the library. + +If no email or password is supplied as input arguments and no config file with those details is found you will be prompted. Same goes for PIN (used to lock or unlock). +The --nowait option will just request the action (or stored information) without waiting for confirmation. +``` +usage: cli.py [-h] [-e EMAIL] [-p PASSWORD] [-s SESSION_FILE] [-v VIN] + [-n PIN] [-m MODEL] [-a] [-c COUNTRY] [-l LANGUAGE] + [-z TIMEZONE] [--nowait] + {list,overview,maintenance,summary,capabilities,emobility,position,triplongterm,tripshortterm,speedalerts,theftalerts,tokens,lock,unlock,climate-on,climate-off,directcharge-on,directcharge-off} + +Porsche Connect CLI. + +positional arguments: + {list,overview,maintenance,summary,capabilities,emobility,position,triplongterm,tripshortterm,speedalerts,theftalerts,tokens,lock,unlock,climate-on,climate-off,directcharge-on,directcharge-off} + +optional arguments: + -h, --help show this help message and exit + -e EMAIL, --email EMAIL + -p PASSWORD, --password PASSWORD + -s SESSION_FILE, --sessionfile SESSION_FILE + -v VIN, --vin VIN + -n PIN, --pin PIN + -m MODEL, --model MODEL + -a, --all + -c COUNTRY, --country COUNTRY + -l LANGUAGE, --language LANGUAGE + -z TIMEZONE, --timezone TIMEZONE + --nowait +``` + +## Config file (for CLI) + +A config file is searched for in ~/.porscheconnect.cfg and ./.porscheconnect.cfg +The format is: + +``` +[porsche] +email=<your email> +password=<your password> +country=<country iso code, default DE> +language=<lang abbreviation, default de> +timezone=<default Europe/Stockholm> +``` + +## Library usage + +Install pyporscheconnectapi using pip (requires python > 3.6) + + +### Example client usage +``` +import asyncio +from pyporscheconnectapi.connection import Connection +from pyporscheconnectapi.client import Client +email = ..your porsche connect email... +password = ...your porsche connect password... + +async def vehicles() -> None: + conn = Connection(email, password) + client = Client(conn) + + vehicles = await client.getVehicles() + for vehicle in vehicles: + print(f"VIN: {vehicle['vin']} Model: {vehicle['modelDescription']} Year: {vehicle['modelYear']}") + + await conn.close() + +loop = asyncio.get_event_loop() +loop.run_until_complete(vehicles()) +``` + +### Example connection usage for custom requests +``` +import asyncio +from pyporscheconnectapi.connection import Connection +from pyporscheconnectapi.client import Client +email = ..your porsche connect email... +password = ...your porsche connect password... + +async def vehicles() -> None: + conn = Connection(email, password) + client = Client(conn) + + vehicles = await client.getVehicles() + for vehicle in vehicles: + print(f"VIN: {vehicle['vin']} Model: {vehicle['modelDescription']} Year: {vehicle['modelYear']}") + # Using connection.get will automatically add auth headers + data = await conn.get(f"https://api.porsche.com/core/api/v3/se/sv_SE/vehicles/{vehicle['vin']}") + print(f"Battery at {data['carControlData']['batteryLevel']['value']}%") + + await conn.close() + +loop = asyncio.get_event_loop() +loop.run_until_complete(vehicles()) +``` + + +## Credits +[evcc](https://github.com/andig/evcc) was a good resource for figuring out the Authentication flow + + +%package help +Summary: Development documents and examples for pyporscheconnectapi +Provides: python3-pyporscheconnectapi-doc +%description help +# pyporscheconnectapi +A python library for Porsche Connect API + +This library will let you access your car equipped with Porsche Connect. It does not work with the predecessor Porsche Car Connect. +Porsche Connect is available for the following Porsche models: + +* Taycan +* 911 (from 992) +* Cayenne (from 2017, E3) +* Panamera (from 2021, G2 PA) + +You can also take a look here, select your model and see if your model has support for Porsche Connect: +https://connect-store.porsche.com/ + +A Porsche Connect subscription alse needs to be active for it to work. + +*NOTE:* This work is not officially supported by Porsche and functionality can stop working at any time without warning + +## Installation + +The easiest method is to install using pip3/pip (venv is also a good idea) +``` +pip install pyporscheconnectapi +``` + +to update to the latest version + +``` +pip install pyporscheconnectapi -U +``` + +Setup will add a cli under the name porschecli, see below for usage + + +## CLI usage + +A simple cli is provided with this library, it will cache tokens to a file to speed up invocations. It does not yet support the create/update/delete timer functionality which is present in the library. + +If no email or password is supplied as input arguments and no config file with those details is found you will be prompted. Same goes for PIN (used to lock or unlock). +The --nowait option will just request the action (or stored information) without waiting for confirmation. +``` +usage: cli.py [-h] [-e EMAIL] [-p PASSWORD] [-s SESSION_FILE] [-v VIN] + [-n PIN] [-m MODEL] [-a] [-c COUNTRY] [-l LANGUAGE] + [-z TIMEZONE] [--nowait] + {list,overview,maintenance,summary,capabilities,emobility,position,triplongterm,tripshortterm,speedalerts,theftalerts,tokens,lock,unlock,climate-on,climate-off,directcharge-on,directcharge-off} + +Porsche Connect CLI. + +positional arguments: + {list,overview,maintenance,summary,capabilities,emobility,position,triplongterm,tripshortterm,speedalerts,theftalerts,tokens,lock,unlock,climate-on,climate-off,directcharge-on,directcharge-off} + +optional arguments: + -h, --help show this help message and exit + -e EMAIL, --email EMAIL + -p PASSWORD, --password PASSWORD + -s SESSION_FILE, --sessionfile SESSION_FILE + -v VIN, --vin VIN + -n PIN, --pin PIN + -m MODEL, --model MODEL + -a, --all + -c COUNTRY, --country COUNTRY + -l LANGUAGE, --language LANGUAGE + -z TIMEZONE, --timezone TIMEZONE + --nowait +``` + +## Config file (for CLI) + +A config file is searched for in ~/.porscheconnect.cfg and ./.porscheconnect.cfg +The format is: + +``` +[porsche] +email=<your email> +password=<your password> +country=<country iso code, default DE> +language=<lang abbreviation, default de> +timezone=<default Europe/Stockholm> +``` + +## Library usage + +Install pyporscheconnectapi using pip (requires python > 3.6) + + +### Example client usage +``` +import asyncio +from pyporscheconnectapi.connection import Connection +from pyporscheconnectapi.client import Client +email = ..your porsche connect email... +password = ...your porsche connect password... + +async def vehicles() -> None: + conn = Connection(email, password) + client = Client(conn) + + vehicles = await client.getVehicles() + for vehicle in vehicles: + print(f"VIN: {vehicle['vin']} Model: {vehicle['modelDescription']} Year: {vehicle['modelYear']}") + + await conn.close() + +loop = asyncio.get_event_loop() +loop.run_until_complete(vehicles()) +``` + +### Example connection usage for custom requests +``` +import asyncio +from pyporscheconnectapi.connection import Connection +from pyporscheconnectapi.client import Client +email = ..your porsche connect email... +password = ...your porsche connect password... + +async def vehicles() -> None: + conn = Connection(email, password) + client = Client(conn) + + vehicles = await client.getVehicles() + for vehicle in vehicles: + print(f"VIN: {vehicle['vin']} Model: {vehicle['modelDescription']} Year: {vehicle['modelYear']}") + # Using connection.get will automatically add auth headers + data = await conn.get(f"https://api.porsche.com/core/api/v3/se/sv_SE/vehicles/{vehicle['vin']}") + print(f"Battery at {data['carControlData']['batteryLevel']['value']}%") + + await conn.close() + +loop = asyncio.get_event_loop() +loop.run_until_complete(vehicles()) +``` + + +## Credits +[evcc](https://github.com/andig/evcc) was a good resource for figuring out the Authentication flow + + +%prep +%autosetup -n pyporscheconnectapi-0.0.26 + +%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-pyporscheconnectapi -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.26-1 +- Package Spec generated |
