From c7397407e2c5952b7b6cd91e9cf3d3c9a004c591 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 29 May 2023 11:32:30 +0000 Subject: automatic import of python-pytrafikverket --- .gitignore | 1 + python-pytrafikverket.spec | 207 +++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 209 insertions(+) create mode 100644 python-pytrafikverket.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..29d97ba 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/pytrafikverket-0.3.3.tar.gz diff --git a/python-pytrafikverket.spec b/python-pytrafikverket.spec new file mode 100644 index 0000000..5f2c33e --- /dev/null +++ b/python-pytrafikverket.spec @@ -0,0 +1,207 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pytrafikverket +Version: 0.3.3 +Release: 1 +Summary: Retreive values from public API at the Swedish Transport Administration (Trafikverket). +License: MIT +URL: https://github.com/endor-force/pytrafikverket +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/1a/6d/e1e80a946a08e21d9e38c731aa30527f5550545dc9c3a23a8ad8fb8b7559/pytrafikverket-0.3.3.tar.gz +BuildArch: noarch + +Requires: python3-aiohttp +Requires: python3-async-timeout +Requires: python3-lxml + +%description +# pytrafikverket +python module for communicating with the swedish trafikverket api + +Development and testing done with 3.10 + +## Code example +```python +from pytrafikverket import TrafikverketTrain, StationInfo +import aiohttp +import asyncio +import async_timeout +from datetime import datetime + +async def main(loop): + async with aiohttp.ClientSession(loop=loop) as session: + train_api = TrafikverketTrain(session, "api_key_here") + stations = await train_api.async_search_train_stations("kristianstad") + for station in stations: + print(station.name + " " + station.signature) + + from_station = await train_api.async_get_train_station("Sölvesborg") + to_station = await train_api.async_get_train_station("Kristianstad C") + product_description = "SJ Regional" # Optional search field + print("from_station_signature: " + from_station.signature) + print("to_station_signature: " + to_station.signature) + train_stop = await train_api.async_get_train_stop(from_station, to_station, datetime(2022, 4, 11, 12, 57), product_description); + print(train_stop.get_state()) + +loop = asyncio.get_event_loop() +loop.run_until_complete(main(loop)) +``` + +## CLI example +```bash +$ py pytrafikverket.py -key -method search-for-station -station "Kristianstad" +$ py pytrafikverket.py -key -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" +$ py pytrafikverket.py -key -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -train-product "SJ Regional" +$ py pytrafikverket.py -key -method get-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -date-time "2017-05-19T16:38:00" +$ py pytrafikverket.py -key -method get-weather -station "Nöbbele" +$ py pytrafikverket.py -key -method search-for-ferry-route -route "sund" +$ py pytrafikverket.py -key -method get-ferry-route -route "Adelsöleden" +$ py pytrafikverket.py -key -method get-next-ferry-stop -from-harbor "Ekerö" +$ py pytrafikverket.py -key -method get-next-ferry-stop -from-harbor "Furusund" -date-time "2019-12-24T00:00:00" +``` + + +%package -n python3-pytrafikverket +Summary: Retreive values from public API at the Swedish Transport Administration (Trafikverket). +Provides: python-pytrafikverket +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pytrafikverket +# pytrafikverket +python module for communicating with the swedish trafikverket api + +Development and testing done with 3.10 + +## Code example +```python +from pytrafikverket import TrafikverketTrain, StationInfo +import aiohttp +import asyncio +import async_timeout +from datetime import datetime + +async def main(loop): + async with aiohttp.ClientSession(loop=loop) as session: + train_api = TrafikverketTrain(session, "api_key_here") + stations = await train_api.async_search_train_stations("kristianstad") + for station in stations: + print(station.name + " " + station.signature) + + from_station = await train_api.async_get_train_station("Sölvesborg") + to_station = await train_api.async_get_train_station("Kristianstad C") + product_description = "SJ Regional" # Optional search field + print("from_station_signature: " + from_station.signature) + print("to_station_signature: " + to_station.signature) + train_stop = await train_api.async_get_train_stop(from_station, to_station, datetime(2022, 4, 11, 12, 57), product_description); + print(train_stop.get_state()) + +loop = asyncio.get_event_loop() +loop.run_until_complete(main(loop)) +``` + +## CLI example +```bash +$ py pytrafikverket.py -key -method search-for-station -station "Kristianstad" +$ py pytrafikverket.py -key -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" +$ py pytrafikverket.py -key -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -train-product "SJ Regional" +$ py pytrafikverket.py -key -method get-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -date-time "2017-05-19T16:38:00" +$ py pytrafikverket.py -key -method get-weather -station "Nöbbele" +$ py pytrafikverket.py -key -method search-for-ferry-route -route "sund" +$ py pytrafikverket.py -key -method get-ferry-route -route "Adelsöleden" +$ py pytrafikverket.py -key -method get-next-ferry-stop -from-harbor "Ekerö" +$ py pytrafikverket.py -key -method get-next-ferry-stop -from-harbor "Furusund" -date-time "2019-12-24T00:00:00" +``` + + +%package help +Summary: Development documents and examples for pytrafikverket +Provides: python3-pytrafikverket-doc +%description help +# pytrafikverket +python module for communicating with the swedish trafikverket api + +Development and testing done with 3.10 + +## Code example +```python +from pytrafikverket import TrafikverketTrain, StationInfo +import aiohttp +import asyncio +import async_timeout +from datetime import datetime + +async def main(loop): + async with aiohttp.ClientSession(loop=loop) as session: + train_api = TrafikverketTrain(session, "api_key_here") + stations = await train_api.async_search_train_stations("kristianstad") + for station in stations: + print(station.name + " " + station.signature) + + from_station = await train_api.async_get_train_station("Sölvesborg") + to_station = await train_api.async_get_train_station("Kristianstad C") + product_description = "SJ Regional" # Optional search field + print("from_station_signature: " + from_station.signature) + print("to_station_signature: " + to_station.signature) + train_stop = await train_api.async_get_train_stop(from_station, to_station, datetime(2022, 4, 11, 12, 57), product_description); + print(train_stop.get_state()) + +loop = asyncio.get_event_loop() +loop.run_until_complete(main(loop)) +``` + +## CLI example +```bash +$ py pytrafikverket.py -key -method search-for-station -station "Kristianstad" +$ py pytrafikverket.py -key -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" +$ py pytrafikverket.py -key -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -train-product "SJ Regional" +$ py pytrafikverket.py -key -method get-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -date-time "2017-05-19T16:38:00" +$ py pytrafikverket.py -key -method get-weather -station "Nöbbele" +$ py pytrafikverket.py -key -method search-for-ferry-route -route "sund" +$ py pytrafikverket.py -key -method get-ferry-route -route "Adelsöleden" +$ py pytrafikverket.py -key -method get-next-ferry-stop -from-harbor "Ekerö" +$ py pytrafikverket.py -key -method get-next-ferry-stop -from-harbor "Furusund" -date-time "2019-12-24T00:00:00" +``` + + +%prep +%autosetup -n pytrafikverket-0.3.3 + +%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-pytrafikverket -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot - 0.3.3-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..bf396a5 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +f7eea0897f8bcc50ec7f4c782f65fd9b pytrafikverket-0.3.3.tar.gz -- cgit v1.2.3