dataportalen
Python access to dataportal.se that gives you plain dicts, not RDF.
Sweden's open-data registry describes its 23,500 datasets in RDF, which means
every value arrives as a web address: a dataset about roads is filed under
http://publications.europa.eu/resource/authority/data-theme/TRAN rather than
under "transport". Working out that it means "transport" is, per the
registry's own documentation, your
problem.
This package makes it not your problem. You search with words and you get dictionaries back.
Install
pip install dataportalen
Distribution and import name are both dataportalen. The unrelated
dataportal package on PyPI is a Korean public-data client — not this.
Search
from dataportalen import Dataportal
with Dataportal(language="sv") as dp: # "en", or "all" for every language
page = dp.datasets(theme="transport", publisher="trafikverket",
updated_after="2024-01-01")
print(page.total)
for dataset in page:
print(dataset.to_dict())
{
"uri": "https://example.org/data/roads",
"title": "Vägtrafiknät",
"themes": ["transport"],
"license": "cc_by_4_0",
"access_rights": "public",
"accrual_periodicity": "annual",
"publisher": {"name": "Trafikverket", "type": "national_authority"},
"distributions": [
{"download_url": ["https://...csv"], "format": "csv"}
]
}
The whole catalogue in one file
from dataportalen import download_catalog
download_catalog("catalog.jsonl")
# 23,580 datasets · 35,151 distributions · 58 MiB · ~6 minutes
One dataset per line, distributions and publisher already nested, with a live progress line while it runs.
Documentation
- docs/guide.md — how to use it: searching, what comes back, the catalogue download, settings, async.
- docs/internals.md — how it is built: where the short values come from, module layout, development, releasing.
Licence
Code is MIT. The bundled label table is third-party data redistributed under CC BY 4.0 and EU Decision 2011/833/EU; both notices are in LICENSE, with the details in docs/internals.md.
Metadata you retrieve is published by its respective publishers, each under its
own licence — check the license field on the dataset.
Metadata
Release files for dataportalen 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dataportalen-0.3.0.tar.gz | 140.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dataportalen-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 235.1 kB
Release files / dataportalen-0.3.0.tar.gz
| Download URL | dataportalen-0.3.0.tar.gz |
|---|---|
| Size | 140.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f94e745bcdd96b9010260c6abcf33b28e204b3ed207130bdc5df4371d1e3867b
|
|
BLAKE2b-256 checksum How to use checksums |
a6bd7700250ca66654dd2de613254638b2a30be814223c4acc99e8c2e12e4728
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / dataportalen-0.3.0-py3-none-any.whl
| Download URL | dataportalen-0.3.0-py3-none-any.whl |
|---|---|
| Size | 94.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3c335e84bb0deefc03ab6fb6794c047aae5e86c2f3dd5623bcccad27f90207b
|
|
BLAKE2b-256 checksum How to use checksums |
598df3e9fb6b2f65172a9dacd4ecddf9c93b469e2a58bcc7778117171c09593d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for dataportalen 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.