FreshPointSync


NameFreshPointSync JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryFreshPoint webpage data parser and syncer.
upload_time2024-07-16 21:52:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2023 Konstantin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords freshpoint freshpoint.cz
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =================================================================
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 <https://freshpoint.cz/>`__ 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 <https://freshpointsync.readthedocs.io>`__ platform.

Installation
------------

FreshPointSync supports Python 3.8 and higher. Official library releases can be
found on `📦 PyPI <https://pypi.org/project/freshpointsync/>`__. To install
the latest stable version of FreshPointSync, use the following CLI command:

.. code-block:: console

   $ pip install freshpointsync

To install the latest development version directly from the project's
`📁 GitHub repository <https://github.com/mykhakos/FreshPointSync>`__, use
the following CLI command:

.. code-block:: console

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

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

- For building documentation:

.. code-block:: console

   $ pip install freshpointsync[docs]

- For running tests:

.. code-block:: console

   $ pip install freshpointsync[tests]

- For linting the code:

.. code-block:: console

   $ pip install freshpointsync[lint]

- For building the package:

.. code-block:: console

   $ pip install freshpointsync[build]

- For all development dependencies (combines all the above options):

.. code-block:: console

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

.. code-block:: python

    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 <https://github.com/mykhakos/FreshPointSync/issues>`__.

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 <https://github.com/mykhakos/FreshPointSync/pulls>`__.

License
-------

FreshPointSync is distributed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "FreshPointSync",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "freshpoint, freshpoint.cz",
    "author": null,
    "author_email": "Konstantin Mykhailov <constantinemykhailov@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ea/5e/728b6cd7874761495fb22f3e56564a520349212019dd3828153c23e94149/freshpointsync-0.2.1.tar.gz",
    "platform": null,
    "description": "=================================================================\r\nFreshPointSync: Data Parser and Syncer for FreshPoint.cz Webpages\r\n=================================================================\r\n\r\nWelcome to FreshPointSync, your go-to asynchronous tool for extracting and \r\ntracking data from *my.freshpoint.cz* product webpages.\r\n\r\n`FreshPoint <https://freshpoint.cz/>`__ is a Czech service providing vending\r\nmachines with healthy snacks, lunches, and desserts for companies.\r\nUnfortunately, the company does not offer any public API for accessing product\r\ndata, such as availability and prices. FreshPointSync is here to help.\r\n\r\nKey Features\r\n------------\r\n\r\n\u26a1 **Asynchronous I/O**. FreshPointSync uses ``asyncio`` and ``aiohttp`` for\r\nefficient web requests, optimal performance, and responsiveness.\r\n\r\n\ud83e\udd44 **Robust HTML Scraping**. FreshPointSync utilizes ``beautifulsoup4`` for \r\ncomprehensive product information extraction from the webpage HTML content.\r\n\r\n\ud83d\udcca **Advanced Data Modeling and Analysis**. FreshPointSync employs ``pydantic`` \r\nfor modeling, analyzing, and serializing extracted data.\r\n\r\n\ud83d\udd14 **Event-Driven Handlers**. FreshPointSync implements the *observer pattern* \r\nto register handlers for specific events, such as product availability changes.\r\n\r\n\ud83d\udd0d **Detailed Logging and Error Handling**. FreshPointSync ensures reliability \r\nand ease of debugging with ``logging`` and safe runners to handle unexpected\r\nexceptions.\r\n\r\n\ud83d\udee0\ufe0f **Clean and Readable Code**. FreshPointSync adheres to *PEP 8* standards and \r\nutilizes *type hints*, ensuring the code is clear, concise, and easy to work \r\nwith.\r\n\r\n\ud83d\udcdc **Comprehensive Documentation**. FreshPointSync offers extensive in-code\r\ndocumentation as well as an official user guide and tutorials hosted on the\r\n`Read the Docs <https://freshpointsync.readthedocs.io>`__ platform.\r\n\r\nInstallation\r\n------------\r\n\r\nFreshPointSync supports Python 3.8 and higher. Official library releases can be\r\nfound on `\ud83d\udce6 PyPI <https://pypi.org/project/freshpointsync/>`__. To install\r\nthe latest stable version of FreshPointSync, use the following CLI command:\r\n\r\n.. code-block:: console\r\n\r\n   $ pip install freshpointsync\r\n\r\nTo install the latest development version directly from the project's\r\n`\ud83d\udcc1 GitHub repository <https://github.com/mykhakos/FreshPointSync>`__, use\r\nthe following CLI command:\r\n\r\n.. code-block:: console\r\n\r\n   $ pip install git+https://github.com/mykhakos/FreshPointSync\r\n\r\nYou can also install optional development dependencies using the following CLI\r\ncommands:\r\n\r\n- For building documentation:\r\n\r\n.. code-block:: console\r\n\r\n   $ pip install freshpointsync[docs]\r\n\r\n- For running tests:\r\n\r\n.. code-block:: console\r\n\r\n   $ pip install freshpointsync[tests]\r\n\r\n- For linting the code:\r\n\r\n.. code-block:: console\r\n\r\n   $ pip install freshpointsync[lint]\r\n\r\n- For building the package:\r\n\r\n.. code-block:: console\r\n\r\n   $ pip install freshpointsync[build]\r\n\r\n- For all development dependencies (combines all the above options):\r\n\r\n.. code-block:: console\r\n\r\n   $ pip install freshpointsync[dev]\r\n\r\nMinimal Example\r\n---------------\r\n\r\nThe following example demonstrates how to fetch data from a FreshPoint webpage \r\nbased on its specific location ID and print the location name, overall product\r\ncount, and the number of available products. The extracted data is then dumped\r\nto a JSON file.\r\n\r\n.. code-block:: python\r\n\r\n    import asyncio\r\n    from freshpointsync import ProductPage\r\n\r\n    LOCATION_ID = 296  # from https://my.freshpoint.cz/device/product-list/296\r\n    CACHE_FILENAME = f'pageData_{LOCATION_ID}.json'\r\n\r\n    async def main() -> None:\r\n        async with ProductPage(location_id=LOCATION_ID) as page:\r\n            await page.update()\r\n\r\n            products_available = [\r\n                p for p in page.data.products.values() if p.is_available\r\n            ]\r\n            print(\r\n                f'Location name: {page.data.location}\\n'\r\n                f'Product count: {len(page.data.products)} '\r\n                f'({len(products_available)} in stock)'\r\n            )\r\n\r\n        page_data = page.data.model_dump_json(indent=4, by_alias=True)\r\n        with open(CACHE_FILENAME, 'w', encoding='utf-8') as file:\r\n            file.write(page_data)\r\n\r\n    if __name__ == '__main__':\r\n        asyncio.run(main())\r\n\r\nReporting Issues and Contributing\r\n---------------------------------\r\n\r\nFreshPointSync is an open-source project in its early development stages. If you\r\nencounter any issues or have suggestions for improvements, please report them on\r\nthe `GitHub Issue tracker <https://github.com/mykhakos/FreshPointSync/issues>`__.\r\n\r\nContributions to FreshPointSync are also welcome! If you would like\r\nto contribute, please fork the repository, implement your changes, and open\r\na Pull Request with a detailed description of your work on the\r\n`GitHub Pull Request page <https://github.com/mykhakos/FreshPointSync/pulls>`__.\r\n\r\nLicense\r\n-------\r\n\r\nFreshPointSync is distributed under the MIT License.\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Konstantin  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "FreshPoint webpage data parser and syncer.",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/mykhakos/FreshPointSync"
    },
    "split_keywords": [
        "freshpoint",
        " freshpoint.cz"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba827a936f3251f37cba5be2a3d6aaad1479260fa5b1e612bdfdecc61bf8e24b",
                "md5": "54efdf809bd7c6f73e2ca99432c2129b",
                "sha256": "f0848e5cc4de606287bc5393ad508301843ac38fea9c7db24f23169758f5a663"
            },
            "downloads": -1,
            "filename": "FreshPointSync-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "54efdf809bd7c6f73e2ca99432c2129b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 40822,
            "upload_time": "2024-07-16T21:52:27",
            "upload_time_iso_8601": "2024-07-16T21:52:27.555700Z",
            "url": "https://files.pythonhosted.org/packages/ba/82/7a936f3251f37cba5be2a3d6aaad1479260fa5b1e612bdfdecc61bf8e24b/FreshPointSync-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea5e728b6cd7874761495fb22f3e56564a520349212019dd3828153c23e94149",
                "md5": "232dfbe4df990d81f833252b1d868e60",
                "sha256": "17225cea64909c97bcf744d8615b652ddab5776b4145a6440c5cce2d39c34997"
            },
            "downloads": -1,
            "filename": "freshpointsync-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "232dfbe4df990d81f833252b1d868e60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 46810,
            "upload_time": "2024-07-16T21:52:29",
            "upload_time_iso_8601": "2024-07-16T21:52:29.184493Z",
            "url": "https://files.pythonhosted.org/packages/ea/5e/728b6cd7874761495fb22f3e56564a520349212019dd3828153c23e94149/freshpointsync-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-16 21:52:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mykhakos",
    "github_project": "FreshPointSync",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "freshpointsync"
}
        
Elapsed time: 1.46451s