Skip to main content

FreshPointSync: Data Parser and Syncer for FreshPoint.cz Webpages

Welcome to FreshPointSync, your go-to asynchronous tool for extracting and tracking data from my.freshpoint.cz product webpages.

FreshPoint is a Czech service providing vending machines with healthy snacks, lunches, and desserts for companies. Unfortunately, the company does not offer any public API for accessing product data, such as availability and prices. FreshPointSync is here to help.

Key Features

⚡ Asynchronous I/O. FreshPointSync uses asyncio and aiohttp for efficient web requests, optimal performance, and responsiveness.

🥄 Robust HTML Scraping. FreshPointSync utilizes beautifulsoup4 for comprehensive product information extraction from the webpage HTML content.

📊 Advanced Data Modeling and Analysis. FreshPointSync employs pydantic for modeling, analyzing, and serializing extracted data.

🔔 Event-Driven Handlers. FreshPointSync implements the observer pattern to register handlers for specific events, such as product availability changes.

🔍 Detailed Logging and Error Handling. FreshPointSync ensures reliability and ease of debugging with logging and safe runners to handle unexpected exceptions.

🛠️ Clean and Readable Code. FreshPointSync adheres to PEP 8 standards and utilizes type hints, ensuring the code is clear, concise, and easy to work with.

📜 Comprehensive Documentation. FreshPointSync offers extensive in-code documentation as well as an official user guide and tutorials hosted on the Read the Docs platform.

Installation

FreshPointSync supports Python 3.8 and higher. Official library releases can be found on 📦 PyPI. To install the latest stable version of FreshPointSync, use the following CLI command:

$ pip install freshpointsync

To install the latest development version directly from the project’s 📁 GitHub repository, use the following CLI command:

$ pip install git+https://github.com/mykhakos/FreshPointSync

You can also install optional development dependencies using the following CLI commands:

  • For building documentation:

$ pip install freshpointsync[docs]
  • For running tests:

$ pip install freshpointsync[tests]
  • For linting the code:

$ pip install freshpointsync[lint]
  • For building the package:

$ pip install freshpointsync[build]
  • For all development dependencies (combines all the above options):

$ pip install freshpointsync[dev]

Minimal Example

The following example demonstrates how to fetch data from a FreshPoint webpage based on its specific location ID and print the location name, overall product count, and the number of available products. The extracted data is then dumped to a JSON file.

import asyncio
from freshpointsync import ProductPage

LOCATION_ID = 296  # from https://my.freshpoint.cz/device/product-list/296
CACHE_FILENAME = f'pageData_{LOCATION_ID}.json'

async def main() -> None:
    async with ProductPage(location_id=LOCATION_ID) as page:
        await page.update()

        products_available = [
            p for p in page.data.products.values() if p.is_available
        ]
        print(
            f'Location name: {page.data.location}\n'
            f'Product count: {len(page.data.products)} '
            f'({len(products_available)} in stock)'
        )

    page_data = page.data.model_dump_json(indent=4, by_alias=True)
    with open(CACHE_FILENAME, 'w', encoding='utf-8') as file:
        file.write(page_data)

if __name__ == '__main__':
    asyncio.run(main())

Reporting Issues and Contributing

FreshPointSync is an open-source project in its early development stages. If you encounter any issues or have suggestions for improvements, please report them on the GitHub Issue tracker.

Contributions to FreshPointSync are also welcome! If you would like to contribute, please fork the repository, implement your changes, and open a Pull Request with a detailed description of your work on the GitHub Pull Request page.

License

FreshPointSync is distributed under the MIT License.

Metadata

Release files for FreshPointSync 0.2.1

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

Source distribution (sdist)

Source distribution for FreshPointSync 0.2.1
File Size Uploaded Provenance
freshpointsync-0.2.1.tar.gz 46.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for FreshPointSync 0.2.1
File Interpreter ABI Platform
FreshPointSync-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 87.6 kB

Release files / freshpointsync-0.2.1.tar.gz

Download URL freshpointsync-0.2.1.tar.gz
Size 46.8 kB
Tags Source
SHA-256 checksum
How to use checksums
17225cea64909c97bcf744d8615b652ddab5776b4145a6440c5cce2d39c34997
BLAKE2b-256 checksum
How to use checksums
ea5e728b6cd7874761495fb22f3e56564a520349212019dd3828153c23e94149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / FreshPointSync-0.2.1-py3-none-any.whl

Download URL FreshPointSync-0.2.1-py3-none-any.whl
Size 40.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0848e5cc4de606287bc5393ad508301843ac38fea9c7db24f23169758f5a663
BLAKE2b-256 checksum
How to use checksums
ba827a936f3251f37cba5be2a3d6aaad1479260fa5b1e612bdfdecc61bf8e24b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Security for FreshPointSync 0.2.1

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

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