Need an API? Try: https://postnummerapi.se/
This is a dataset of all possible post numbers in Sweden, along with names of streets within the postcode's geographic location, provided in CSV and JSON format.
You can read more about the postcodes format used in Sweden on wikipedia.
This dataset is scraped from Posten.se using the search service, as I couldn't find a dataset of all postal codes in Sweden with street names and street/box-numbers of each one.
Note: Some of these postcodes don't have the entire set of street names and box
numbers within their area as the search page limits the number of results (~100),
for example: 647 91
.
The scraping is done with a simple script written using Scrapy and is available in src/scrape.py.
To run again, make sure you pip install scrapy
and then just run:
scrapy runspider scrape.py
Code in scraping script and csv-to-json conversion is licensed under MIT.