Skip to main content

ORLEN wholesale fuel-price scraper

This repository downloads the public price data shown on ORLEN's Hurtowe ceny paliw page. It covers every section currently visible there:

  • motor fuels (all products returned by the API),
  • wholesale autogas/LPG (all 16 regions),
  • heavy fuel oil,
  • aviation fuels (all locations).

It calls the page's JSON API sequentially. The default random 2–4 second gap, 24-hour disk cache, incremental CSV/state tracking, Retry-After handling, exponential backoff, and atomic output make long runs polite and resumable. Do not run many copies in parallel.

Installation

From GitHub:

python -m pip install git+https://github.com/solek13/orlen.git

From a local checkout:

python -m pip install -e .

After installation, the command-line tool is available as orlen-prices.

Usage

Python 3.10+ is sufficient; there are no third-party dependencies.

# After installation
orlen-prices --year 2026 --output data\prices.csv

# Current year (the default)
python .\scrape_orlen.py

# A particular year
python .\scrape_orlen.py --year 2025

# Everything exposed by the API (slowest, especially LPG)
python .\scrape_orlen.py --all

# January 1, 2013 through today (also accepts: --since 2013)
python .\scrape_orlen.py --from-year 2013

# Choose the destination
python .\scrape_orlen.py --year 2026 --output data\prices.csv

The default files are data/orlen_prices_<year>.csv, data/orlen_prices_since_<year>.csv, and data/orlen_prices_all.csv. Each CSV has a small .csv.state.json sidecar. It records the date range already checked for every product, including products which returned no rows. A later run loads and merges the existing CSV, requests only dates after the recorded coverage, and skips LPG effective dates already present. The state is bound to a hash of the CSV so deleting or modifying the data cannot silently cause ranges to be skipped.

Product lists and LPG date indexes are checked through the 24-hour cache so new products/dates can still be discovered without repeatedly downloading price history. Use --refresh only when those missing-range requests really need to bypass the cache. An interrupted run can simply be started again; completed requests remain in the response cache.

The all-history run deliberately stays single-threaded. Regular, heavy-oil, and aviation history need only a few range requests. ORLEN exposes LPG history one effective date at a time, so that part can take several minutes. Progress is printed to stderr.

The CSV contains category/product metadata, effective and publication dates, price, frontend display unit, location (where applicable), exact source URL, and fetch timestamp. ORLEN's API currently sends a null unit; unit is filled from the units displayed in the corresponding ORLEN frontend tables.

Library functions

from scrape_orlen import scrape_all, scrape_since, scrape_year, update_csv, write_csv

rows = scrape_year()          # current year
# rows = scrape_all()         # complete available history
# rows = scrape_since(2013)   # 2013 through today
write_csv(rows, "prices.csv")

# Preferred for scheduled runs: merges existing rows and downloads only gaps.
rows = update_csv("prices.csv")

Tests

python -m unittest -v

The tests use a fake API and do not contact ORLEN.

Packaging

Build the source distribution and wheel locally:

python -m pip install -e .[dev]
python -m build
python -m twine check dist/*

Installing by package name, for example python -m pip install orlen-price-scraper, requires uploading a release to PyPI first.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orlen_price_scraper-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orlen_price_scraper-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file orlen_price_scraper-0.1.0.tar.gz.

File metadata

  • Download URL: orlen_price_scraper-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for orlen_price_scraper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e886d3d0153ca3c160fef20be4edcba9e741a5e2c03d0928d9b603761a8a82a6
MD5 a64a56732090a60d4f29582a28d9d25d
BLAKE2b-256 45aaf740ce75696ed7d04284c073d22ccf90bfb0f55557ad6a329c47feeca050

See more details on using hashes here.

Provenance

The following attestation bundles were made for orlen_price_scraper-0.1.0.tar.gz:

Publisher: publish.yml on solek13/orlen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orlen_price_scraper-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for orlen_price_scraper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88ac75c1232ab3c7e73ad951bee4c04a107233a9f06625a766f06acc0f688764
MD5 3dd27b2a7c01bac04e74cf31916feb78
BLAKE2b-256 e47569021c34515316ae600ae04d09f74d54b038e345235ce50bb78ada21eee3

See more details on using hashes here.

Provenance

The following attestation bundles were made for orlen_price_scraper-0.1.0-py3-none-any.whl:

Publisher: publish.yml on solek13/orlen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page