Skip to main content

Traffic Data Fetcher

A command line tool for retrieving information about counter sites and retrieving traffic data from Eco Counter's traffic monitoring stations.

Installation

Traffic Data Fetcher requires Python 3.8 or higher. The recommended way to install Traffic Data Fetcher is via pipx:

python3 -m pipx install traffic-data-fetcher

Alternatively, pipx allows directly running Traffic Data Fetcher without installing it first:

python3 -m pipx run traffic-data-fetcher YOUR-ARGS-HERE

Organisation of the traffic monitoring stations

Eco Counter calls their traffic monitoring stations counter sites. A counter site groups counters positioned at the same location. A counter collects data for a specific means of transport and a specific direction of travel. Each counter site belongs to a domain. A domain groups a number of counter sites which are typically operated by a city or district administration.

A counter site may be either public or non-public. Detailed traffic data separated by direction is only available for public sites. Traffic Data Fetcher currently does not support fetching data from non-public sites.

Usage

Traffic Data Fetcher supports the commands list-domains, list-sites, and fetch-counts.

By default, the commands write their results to standard output in csv format. By passing a file name with the -f or --file option the results can be saved into a csv file.

Standard options:

  • -h, --help: show a help message and exit
  • --version: show the version of traffic-data-fetcher and exit

List all domains

Retrieves a list of all known domains. As there is no official queryable list of domains, the list-domains command relies on a list which is regularly updated by a cloud service that checks all domain ids between 1 and 10.000 for existing domains.

Usage: traffic-data-fetcher list-domains [-h] [-f FILE]

Options:

  • -h, --help: show a help message and exit
  • -f, --file FILE: store a domain list in a csv-file. Existing files are overwritten

List counter sites

Retrieves detailed information for all (public and non-public) counter sites within a specified domain, or for the provided counter sites. If individual counter sites are queried, only public sites can be retrieved.

Usage: traffic-data-fetcher list-sites [-h] (-d DOMAIN_ID | -s SITE_IDS [SITE_IDS ...]) [-f FILE]

Options:

  • -h, --help: show a help message and exit
  • -d, --domain DOMAIN_ID: id of the domain whose counter sites should be listed
  • -s, --sites SITE_IDS [SITE_IDS ...]: ids of the counter sites to list
  • -f, --file FILE: store counter sites in a csv-file. Existing files are overwritten

Fetch counter data

Retrieves traffic data from all public counter sites within a specified domain or from the provided public counter sites. The returned data can be filtered by means of transport and direction, and constrained by time range and temporal resolution.

Usage:

traffic-data-fetcher fetch-counts [-h] (-d DOMAIN_ID | -s SITE_IDS [SITE_IDS ...]) 
                                  [-f FILE] 
                                  [-S {quarter_of_an_hour,hour,day,week,month}]
                                  [-B BEGIN] [-E END] 
                                  [-D {in,out,none} [{in,out,none} ...]]
                                  [-M {foot,bike,horse,car,bus,minibus,undefined,motorcycle,kayak,e_scooter,truck} 
                                      [{foot,bike,horse,car,bus,minibus,undefined,motorcycle,kayak,e_scooter,truck} 
                                      ...]]`

Options:

  • -h, --help: show a help message and exit
  • -d, --domain DOMAIN_ID: id of the domain whose counter sites should be fetched
  • -s, --sites SITE_IDS [SITE_IDS ...]: ids of the counter sites to fetch
  • -f, --file FILE: store data in a csv-file. Existing files are overwritten
  • -S, --step-size {quarter_of_an_hour,hour,day,week,month}: step size of the data to fetch. Defaults to hour
  • -B, --begin BEGIN: fetch data starting at date. Date must be ISO 8610 formatted (YYYY-MM-DD)
  • -E, --end END: fetch data until date (exclusively). Date must be ISO 8610 formatted (YYYY-MM-DD)
  • -D, --direction {in,out,none} [{in,out,none} ...]: select directions to fetch. By default, data for all directions is fetched
  • -M, --means-of-transport {foot,bike,horse,car,bus,minibus,undefined,motorcycle,kayak,e_scooter,truck} [{foot,bike,horse,car,bus,minibus,undefined,motorcycle,kayak,e_scooter,truck} ...]: select means of transport to fetch. By default, data for all means of transport is fetched

Examples

  • Show the list of known domains:
    traffic-data-fetcher list-domains
    
  • Show details for all counter sites in the domain Stadt Bonn:
    traffic-data-fetcher list-sites --domain 4701
    

- Retrieve the monthly count data for all counters at the two counter sites *Kennedybrücke (Nordseite)* and *Kennedybrücke (Südseite)* in Bonn:

traffic-data-fetcher fetch-counts --sites 100019809,100019810 --step-size month
  • Retrieve the monthly count data for cars entering Ludwigsburg via Bismarckstraße (the counter site records counts for both bicycles and cars):
    # Get the details of the counter site to find out 
    # which direction corresponds to going into town:
    traffic-data-fetcher list-sites --sites 300015617
    # Going into town is represented by direction in (unsurprisingly).
    # Using this information the data can be fetched like this:
    traffic-data-fetcher fetch-counts --sites 300015617 --step-size month --direction IN --means-of-transport car
    
  • Retrieve hourly count data per recorded at the counter site Rhenusallee in Bonn for the dates Saturday, April 5, 2025, and Sunday, April 6, 2025:
    traffic-data-fetcher fetch-counts --sites 100019729 --begin 2025-04-05 --end 2025-04-07
    

Acknowledgements

Special thanks to Pascua Theus for providing the groundwork for accessing Eco Counter's API in his blog post on counting bicycles and to the Bundesstelle for Open Data for their documentation of the Eco-Visio-API. Their contributions were essential to making this project possible.

Metadata

Release files for traffic-data-fetcher 1.1.0

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

Source distribution (sdist)

Source distribution for traffic-data-fetcher 1.1.0
File Size Uploaded
traffic_data_fetcher-1.1.0.tar.gz 24.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for traffic-data-fetcher 1.1.0
File Interpreter ABI Platform
traffic_data_fetcher-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.0 kB

Release files / traffic_data_fetcher-1.1.0.tar.gz

Download URL traffic_data_fetcher-1.1.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
045879aaa6cf6f308270abd1b87bdcb65d7c34450386e27beca5af53b53fd802
BLAKE2b-256 checksum
How to use checksums
882cb3ce3ac49d9816393f99a6f378f7e5330244edd6a31e58c4a1da3dd16672
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 26, 2025.

Transparency log

Release files / traffic_data_fetcher-1.1.0-py3-none-any.whl

Download URL traffic_data_fetcher-1.1.0-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e18a42db91e9b28c1a729edc6548c72378acbba625e11e485a56eaa8f93fb168
BLAKE2b-256 checksum
How to use checksums
d7a14fd471ff116ecb9a9d4604a06a803823cae177eb01c06512b7a580cc4c4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 26, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

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