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 PyPI:

python -m pip install orlen-price-scraper

Directly 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.

License

MIT License. See LICENSE.

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.

Metadata

Release files for orlen-price-scraper 0.1.2

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

Source distribution (sdist)

Source distribution for orlen-price-scraper 0.1.2
File Size Uploaded Provenance Actions
orlen_price_scraper-0.1.2.tar.gz 10.9 kB With provenance Details for orlen_price_scraper-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orlen-price-scraper 0.1.2
File Interpreter ABI Platform Actions
orlen_price_scraper-0.1.2-py3-none-any.whl Python 3 none any Details for orlen_price_scraper-0.1.2-py3-none-any.whl

Total release size: 22.3 kB

Release files / orlen_price_scraper-0.1.2.tar.gz

Download URL orlen_price_scraper-0.1.2.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1531ecb9ac460f761c7a63beeb0935930199abbcc90cf219eacf2612627732cc
BLAKE2b-256 checksum
How to use checksums
f12b5786e7fb9f4b8e2bd7a49660fac715edfeab5329e29ec08aebcc7825eb3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Release files / orlen_price_scraper-0.1.2-py3-none-any.whl

Download URL orlen_price_scraper-0.1.2-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a324588125bf40e7c3385c2a4c6d316e41b930eac7107a8bc8e504a14a7c6e14
BLAKE2b-256 checksum
How to use checksums
bed213224fcff9551af4444899582b28b3e8521b0a385180b4cef90e0ac521e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 5, 2026.

Transparency log

Security for orlen-price-scraper 0.1.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for orlen_price_scraper-0.1.2.tar.gz

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 Aug 5, 2026.

Transparency log

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