%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 * Wed May 31 2023 Python_Bot - 0.3.3-1 - Package Spec generated