pytrafikverket
Retrieve values from public API at the Swedish Transport Administration (Trafikverket).
Decision gist · record as of 2026-08-14
Yes, if you need to query Swedish Trafikverket data. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and installs with low friction. The async design and modern Python support (3.11+) make it well-suited for contemporary applications. Verify that your use case aligns with Trafikverket's API terms and that you can obtain an API key.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a valid Trafikverket API key; obtain one from the Swedish Transport Administration before use.
- Low friction install with a pure-Python wheel.
- Actively maintained as of 2026-08-12 with recent releases.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal attribution requirements.
last release 2024-11-22 (630 days) · last repo commit 2026-08-12 · 26 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 73,466 downloads/mo, #14,995 on PyPI
Alternatives
Verify before relying
import asyncio
import aiohttp
from pytrafikverket import TrafikverketTrain
async def main():
async with aiohttp.ClientSession() as session:
train_api = TrafikverketTrain(session, "your_api_key")
stations = await train_api.async_search_train_stations("kristianstad")
for station in stations:
print(station.name)
asyncio.run(main())- Whether the Trafikverket API key is free or requires registration/payment
- Rate limits or quotas enforced by the Trafikverket API
- Geographic scope: whether the API covers all Swedish transport or only specific regions
What it is and what it does
Pytrafikverket is an async Python wrapper around the Swedish Transport Administration's (Trafikverket) public API. It provides high-level methods to search and retrieve train station information, query train schedules between stations, look up ferry routes and schedules, and fetch weather data at transport locations. The library uses aiohttp for non-blocking HTTP requests, making it suitable for integration into async applications or services that need to poll transport data without blocking.
The package includes both a programmatic API (via TrafikverketTrain and related classes) and a CLI tool for direct queries. It requires an API key from Trafikverket and Python 3.11 or later. Dependencies are lightweight: aiohttp for HTTP, lxml for XML parsing, yarl for URL handling, and aiozoneinfo for timezone support.
Use it for
- Build a travel planner or commute app that queries real-time Swedish train schedules and station information.
- Monitor ferry route availability and schedules for Swedish waterway transport.
- Fetch weather conditions at Swedish transport hubs for operational decision-making.
- Create a CLI tool or dashboard that displays next available train or ferry departures.
- Integrate transport data into a broader Swedish logistics or mobility platform.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to query Swedish Trafikverket data.
The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and installs with low friction. The async design and modern Python support (3.11+) make it well-suited for contemporary applications. Verify that your use case aligns with Trafikverket's API terms and that you can obtain an API key.
Install
pytrafikverket on PyPI
Before you install
Low friction install with a pure-Python wheel. Actively maintained as of 2026-08-12 with recent releases. Supports Python 3.11, 3.12, and 3.13.
Requires a valid Trafikverket API key; obtain one from the Swedish Transport Administration before use.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal attribution requirements.
Quickstart
import asyncio
import aiohttp
from pytrafikverket import TrafikverketTrain
async def main():
async with aiohttp.ClientSession() as session:
train_api = TrafikverketTrain(session, "your_api_key")
stations = await train_api.async_search_train_stations("kristianstad")
for station in stations:
print(station.name)
asyncio.run(main())
Verify before relying
- Whether the Trafikverket API key is free or requires registration/payment
- Rate limits or quotas enforced by the Trafikverket API
- Geographic scope: whether the API covers all Swedish transport or only specific regions
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesaiohttpaiozoneinfolxmlyarl |
| Maintenance | Actively maintained 630 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 73,466 / month, #14,995 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Libraries :: Python Modules |
Evidence: pytrafikverket-1.1.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “swedish trafikverket api client”
- pytrafikverketAsync Python client for querying Sweden's Trafikverket public API to…
- PyStemmerPyStemmer provides word stemming algorithms for multiple languages,…
- xkcdpassGenerates strong, memorable passphrases by randomly selecting words…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also aioymaps · radios · imgw-pib · aioambient · ocpp · PyRMVtransport · gios · pyairvisual · aioecowitt · pyatmo