Skip to main content

Extract league rankings from the DBB (Deutscher Basketball Bund e.V.) website.

This library has been extracted from the web application behind the website of the BTB Royals Oldenburg (a basketball team from Oldenburg, Germany) where it has proven itself for many, many years.

Website

The official micro website is at: https://homework.nwsnet.de/releases/4a51/#dbb-ranking-parser

Code Status

Testing Status

Requirements

Installation

Install this package via pip:

$ pip install dbb-ranking-parser

Pre-built binaries (so-called Python “wheels”) should be available for supported Python versions and most architectures.

If not, however, it can be necessary to install a compiler and certain header files (for the targeted Python version as well as those for libxml2 and libxslt) so that lxml can be built from source.

On Debian Linux, one should be able to install these from the distribution’s repositories (as the ‘root’ user):

# aptitude update
# aptitude install build-essential python3.9-dev libxml2-dev libxslt1-dev

Usage

To fetch and parse a league ranking, the appropriate URL is required.

It can be obtained on the DBB website. On every league’s ranking page there should be a link to a (non-“XL”) HTML print version.

Its target URL should look like this (assuming the league’s ID is 12345): https://www.basketball-bund.net/public/tabelle.jsp?print=1&viewDescKey=sport.dbb.views.TabellePublicView/index.jsp_&liga_id=12345

The league ID has to be identified manually in any of the URLs specific for that league (ranking, schedule, stats).

For convenience, specifying only the league ID is sufficient; the URL will be assembled automatically. (Obviously, this might break when the URL structure changes on the DBB website.)

Programmatically

from dbbrankingparser import load_ranking_for_league


league_id = 12345

ranking = list(load_ranking_for_league(league_id))

top_team = ranking[0]
print('Top team:', top_team['name'])

The URL can be specified explicitly, too:

from dbbrankingparser import load_ranking_from_url


URL = '<see example above>'

ranking = list(load_ranking_from_url(URL))

Note that a call to a load_ranking_* method returns a generator. To keep its elements around, and also to access them by index, they can be fed into a list (as shown above).

On the Command Line

The package includes a command line script to retrieve a league’s rankings non-programmatically, as JSON. It requires a league ID as its sole argument:

$ dbb-ranking-parser get 12345
[{"name": "Team ACME", "rank": 1, …}]

Via HTTP

Also included is an HTTP wrapper around the parser.

To spin up the server:

$ dbb-ranking-parser serve
Listening for HTTP requests on 127.0.0.1:8080 ...

The server will attempt to look up a ranking for requests with an URL part of the form /<league id>:

$ curl http://localhost:8080/12345
[{"name": "Team ACME", "rank": 1, …}]

Docker

DBB Ranking Parser can also be run in a Docker container. This avoids the local creation of a virtual environment and the installation of the packages, or be useful in a deployment where containers are used.

Building a Docker image requires:

  • Docker being installed

  • a source copy of the dbb-ranking-parser package

In the package path:

$ docker build -t dbb-ranking-parser .

This should build a Docker image based upon Alpine Linux and which includes Python 3, lxml and the DBB Ranking Parser itself. It should be roughly 70 MB in size.

Running the Docker container accepts the same arguments as the command line script.

To fetch a single ranking:

$ docker run --rm dbb-ranking-parser get 12345
[{"name": "Team ACME", "rank": 1, …}]

To spin up the HTTP server on port 7000 of the host machine:

$ docker run -p 7000:8080 --rm dbb-ranking-parser serve --host 0.0.0.0 --port 8080

The --rm option causes a container (but not the image) to be removed after it exits.

Author

DBB Ranking Parser was created and is maintained by Jochen Kupperschmidt.

License

Copyright (c) 2006-2025 Jochen Kupperschmidt

DBB Ranking Parser is licensed under the MIT License.

The license text is provided in the LICENSE file.

Metadata

Release files for dbb-ranking-parser 1.0.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 dbb-ranking-parser 1.0.0
File Size Uploaded Provenance
dbb_ranking_parser-1.0.0.tar.gz 27.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dbb-ranking-parser 1.0.0
File Interpreter ABI Platform
dbb_ranking_parser-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 37.3 kB

Release files / dbb_ranking_parser-1.0.0.tar.gz

Download URL dbb_ranking_parser-1.0.0.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
15a0283fb4b72062c7cc0e766c2a609f3dcbe135738da5380bd96b7edbb4ba28
BLAKE2b-256 checksum
How to use checksums
70ad68d15bf6661775f86118eb03d77fd5ddc94f9320ae50dc341da68d7f37a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.15

Release files / dbb_ranking_parser-1.0.0-py3-none-any.whl

Download URL dbb_ranking_parser-1.0.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0b868baf2caf59077c3771d39f54876ff9cb82a58cf85f9c589cfcfc9d86b4e
BLAKE2b-256 checksum
How to use checksums
2dc4be781233b2cbacf9a44e64c042ba040fdd7eeb742846ccc9b0fa3b361110
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.15

Security for dbb-ranking-parser 1.0.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.

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