Skip to main content

PLZ Rest API

A simple rest API that exposes data related to zip codes and buildings in Berlin.

This project is the Python implementation of PLZ

The source dataset is published by Esri and is available here.

Motivations

Built as an exercise

Rest API

PLZ provides the following endpoints:

  • /status returns the status of the service
  • /zip/buildings returns the number of buildings aggregated by zip code
  • /zip/buildings/history returns the number of buildings aggregated by zip code and year
  • /zip/buildings/:code returns the number of buildings for a specific zip code
  • /zip/buildings/:code/history returns the number of buildings aggregated by zip code and year for a specific zip code

Usage

There are 2 ways to run the PLZ api service: using Docker(recommended) or via manual setup.

For best results with Docker please use the image from the go project as described here since the image is orders of magnitude smaller.

Manual setup

Those are the steps to run the project manually:

  1. Install the library
pip install plzpy
  1. Download the dataset linked above:
curl -L https://opendata.arcgis.com/datasets/273bf4ae7f6a460fbf3000d73f7b2f76_0.csv?outSR=%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D -o /tmp/src.csv
  1. Massage the dataset to produce an optimized json to be served via the Rest API
plzpy massage --in /tmp/src.csv --out rest.json
  1. Run the Rest API service
plzpy serve --data rest.json

asciicast

Development

The project relies on poetry.

Metadata

Release files for plzpy 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plzpy 0.1.3
File Size Uploaded Provenance Actions
plzpy-0.1.3.tar.gz 5.7 kB Without provenance Details for plzpy-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plzpy 0.1.3
File Interpreter ABI Platform Actions
plzpy-0.1.3-py3-none-any.whl Python 3 none any Details for plzpy-0.1.3-py3-none-any.whl

Total release size: 12.4 kB

Release files / plzpy-0.1.3.tar.gz

Download URL plzpy-0.1.3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cb751863412c517597818e9afefb69d33e0c4eb8418e81a8b79f2cefeac25f67
BLAKE2b-256 checksum
How to use checksums
8662c2bb68fada50af43187871263bf6182232ecdfd242d93bc14218d06e7605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.2 Linux/5.4.0-7634-generic

Release files / plzpy-0.1.3-py3-none-any.whl

Download URL plzpy-0.1.3-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38726c25d0a98b7a86ddacecbdd3bc7c630fb92c9fc186cf1841a4e1f275abef
BLAKE2b-256 checksum
How to use checksums
b22a0996609678a9576bbdbab6389b8e85d0ef057a59a17852a28db433e08b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.2 Linux/5.4.0-7634-generic

Security for plzpy 0.1.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page