Skip to main content

A Python package for downloading and extracting the data from heisse-preise.io with no dependencies.

Project description

Heisse Preise Data

Project Overview

This project provides compressed datasets derived from heisse-preise.io, offering an easy and efficient way to access up-to-date pricing data from supermarkets in Austria.

Data Sources

The data originates from:

Build Process

  • The dataset is built daily to ensure the latest pricing data is available.
  • The most recent build can be downloaded from the following link: https://github.com/falknerdominik/heisse-preise-data/releases/latest/download/latest-canonical.tar.gz

Usage Examples

Download and Extract Data

Python Package

pip install heisse-preise-data
from heisse_preise_data import download

try:
    raw = download()
    print(json.dumps(raw, indent=2))
except RuntimeError as e:
    print(f"An error occurred: {e}")
from heisse_preise_data import download
import pandas as pd

try:
    data = pd.DataFrame(download())
    data.head(5)
except RuntimeError as e:
    print(f"An error occurred: {e}")

Python Example

import requests
import tarfile
import io
import json

url = 'https://github.com/falknerdominik/heisse-preise-data/releases/latest/download/latest-canonical.tar.gz'
json_filename = 'latest-canonical.json'

try:
    # Download the tar.gz file into memory
    response = requests.get(url)
    response.raise_for_status()

    # Open the tar.gz file directly from memory
    with tarfile.open(fileobj=io.BytesIO(response.content), mode='r:gz') as tar:
        # Extract and read the JSON file directly from the tar archive
        json_file = tar.extractfile(json_filename)
        if json_file:
            json_data = json.load(json_file)
            print(json.dumps(json_data, indent=2))
        else:
            print(f"{json_filename} not found in the archive.")

except requests.RequestException as e:
    print(f"Error downloading data: {e}")
except (tarfile.TarError, json.JSONDecodeError) as e:
    print(f"Error processing files: {e}")

JavaScript Example (Node.js)

const https = require('https');
const fs = require('fs');
const tar = require('tar');

const url = 'https://github.com/falknerdominik/heisse-preise-data/releases/latest/download/latest-canonical.tar.gz';

https.get(url, (response) => {
    const file = fs.createWriteStream('latest-canonical.tar.gz');
    response.pipe(file);
    file.on('finish', () => {
        file.close();
        tar.x({ file: 'latest-canonical.tar.gz' }).then(() => {
            fs.readFile('latest-canonical.json', (err, data) => {
                if (err) throw err;
                const jsonData = JSON.parse(data);
                console.log(JSON.stringify(jsonData, null, 2));
            });
        });
    });
}).on('error', (err) => {
    console.error(Error downloading data: ${err.message});
});

Contributing

If you wish to contribute or improve the project, feel free to open an issue or submit a pull request.

Build

python -m build

License

This project is licensed under the terms provided by the original data sources.

Project details


Download files

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

Source Distribution

heisse_preise_data-1.0.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

heisse_preise_data-1.0.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file heisse_preise_data-1.0.2.tar.gz.

File metadata

  • Download URL: heisse_preise_data-1.0.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for heisse_preise_data-1.0.2.tar.gz
Algorithm Hash digest
SHA256 14186b48d307c4f042f392c9da2eb936c6daad4dced4c37598a47e890074a088
MD5 d820f4b336e271f2f1413bb67f9c2fd0
BLAKE2b-256 45919303bde7749a9f6d2b41168ee1ac919d4f71bf4b2d5bcdd5dfe9c0a8bddd

See more details on using hashes here.

File details

Details for the file heisse_preise_data-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for heisse_preise_data-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1227a49a2df05ea1b605578ee82f69a2a9c9c3154e554e03ac2560a45f47a0f1
MD5 2eeb931c0e096976122bc58c0294805b
BLAKE2b-256 b929ba80fe416e31fbe7325c89b89372ce5a2e7015768cfe14c4f121335dcec2

See more details on using hashes here.

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