lidl-plus


Namelidl-plus JSON
Version 0.3.5 PyPI version JSON
download
home_page
SummaryFetch receipts and more from Lidl Plus
upload_time2024-02-08 23:36:57
maintainer
docs_urlNone
authorAndre Basche
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **This python package is unofficial and is not related in any way to Lidl. It was developed by reversed engineered requests and can stop working at anytime!**

# Python Lidl Plus API
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Andre0512/lidl-plus/python-check.yml?branch=main&label=checks)](https://github.com/Andre0512/lidl-plus/actions/workflows/python-check.yml)
[![PyPI - Status](https://img.shields.io/pypi/status/lidl-plus)](https://pypi.org/project/lidl-plus)
[![PyPI](https://img.shields.io/pypi/v/lidl-plus?color=blue)](https://pypi.org/project/lidl-plus)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lidl-plus)](https://www.python.org/)
[![PyPI - License](https://img.shields.io/pypi/l/lidl-plus)](https://github.com/Andre0512/lidl-plus/blob/main/LICENCE)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/lidl-plus)](https://pypistats.org/packages/lidl-plus)
[![Buy Me a Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg)](https://www.buymeacoffee.com/andre0512)  


Fetch receipts and more from Lidl Plus.
## Installation
```bash
pip install lidl-plus
```

## Authentication
To login in Lidl Plus we need to simulate the app login.
This is a bit complicated, we need a web browser and some additional python packages.
After we have received the token once, we can use it for further requestes and we don't need a browser anymore.

#### Prerequisites
* Check you have installed one of the supported web browser
  - Chromium
  - Google Chrome
  - Mozilla Firefox
  - Microsoft Edge
* Install additional python packages
  ```bash
  pip install "lidl-plus[auth]"
  ```
#### Commandline-Tool
```bash
$ lidl-plus auth
Enter your language (de, en, ...): de
Enter your country (DE, AT, ...): AT
Enter your lidl plus username (phone number): +4915784632296
Enter your lidl plus password:
Enter the verify code you received via phone: 590287
------------------------- refresh token ------------------------
2D4FC2A699AC703CAB8D017012658234917651203746021A4AA3F735C8A53B7F
----------------------------------------------------------------
```

#### Python
```python
from lidlplus import LidlPlusApi

lidl = LidlPlusApi(language="de", country="AT")
lidl.login(phone="+4915784632296", password="password", verify_token_func=lambda: input("Insert code: "))
print(lidl.refresh_token)
```
## Usage
Currently, the only features are fetching receipts and activating coupons
### Receipts

Get your receipts as json and receive a list of bought items like:
```json
{
    "currentUnitPrice": "2,19",
    "quantity": "1",
    "isWeight": false,
    "originalAmount": "2,19",
    "name": "Vegane Frikadellen",
    "taxGroup": "1",
    "taxGroupName": "A",
    "codeInput": "4023456245134",
    "discounts": [
        {
            "description": "5€ Coupon",
            "amount": "0,21"
        }
    ],
    "deposit": null,
    "giftSerialNumber": null
},
```

#### Commandline-Tool
```bash
$ lidl-plus --language=de --country=AT --refresh-token=XXXXX receipt --all > data.json
```

#### Python
```python
from lidlplus import LidlPlusApi

lidl = LidlPlusApi("de", "AT", refresh_token="XXXXXXXXXX")
for receipt in lidl.tickets():
    pprint(lidl.ticket(receipt["id"]))
```

### Coupons

You can list all coupons and activate/deactivate them by id
```json
{
    "sections": [
        {
            "name": "FavoriteStore",
            "coupons": []
        },
        {
            "name": "AllStores",
            "coupons": [
                {
                    "id": "2c9b3554-a09c-412c-8be4-d41cbff13572",
                    "image": "https://lidlplusprod.blob.core.windows.net/images/coupons/LT/IDISC0000254911.png?t=1695452076",
                    "type": "Standard",
                    "offerTitle": "1 + 1",
                    "title": "👨🏻‍🍳 Frozen 👨🏻‍🍳",
                    "offerDescriptionShort": "FREE",
                    "isSegmented": false,
                    "startValidityDate": "2023-09-24T21:00:00Z",
                    "endValidityDate": "2023-10-01T20:59:59Z",
                    "isActivated": false,
                    "apologizeText": "Xxxxxxxxxxxxxxxxx",
                    "apologizeStatus": false,
                    "apologizeTitle": "Xxxxxxxxxxxxxxxxxxx",
                    "promotionId": "DISC0000254911",
                    "tagSpecial": "",
                    "firstColor": "#ffc700",
                    "secondaryColor": null,
                    "firstFontColor": "#4a4a4a",
                    "secondaryFontColor": null,
                    "isSpecial": false,
                    "hasAsterisk": false,
                    "isHappyHour": false,
                    "stores": []
                },
                .......
            ]
        },
        {
            "name": "OtherStores",
            "coupons": []
        }
    ]
}
```

#### Commandline-Tool

Activate all available coupons

```bash
$ lidl-plus --language=de --country=AT --refresh-token=XXXXX coupon --all
```

#### Python
```python
from lidlplus import LidlPlusApi

lidl = LidlPlusApi("de", "AT", refresh_token="XXXXXXXXXX")
for section in lidl.coupons()["sections"]:
  for coupon in section["coupons"]:
    print("found coupon: ", coupon["title"], coupon["id"])
```

## Help
#### Commandline-Tool
```commandline
Lidl Plus API

options:
  -h, --help                show this help message and exit
  -c CC, --country CC       country (DE, BE, NL, AT, ...)
  -l LANG, --language LANG  language (de, en, fr, it, ...)
  -u USER, --user USER      Lidl Plus login username
  -p XXX, --password XXX    Lidl Plus login password
  --2fa {phone,email}       choose two factor auth method
  -r TOKEN, --refresh-token TOKEN
                            refresh token to authenticate
  --skip-verify             skip ssl verification
  --not-accept-legal-terms  not auto accept legal terms updates
  -d, --debug               debug mode

commands:
  auth                      authenticate and get token
  receipt                   output last receipts as json
  coupon                    activate coupons
```

## Support
If you find this project helpful and would like to support its development, you can buy me a coffee! ☕

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/andre0512)

Don't forget to star the repository if you found it useful! ⭐

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "lidl-plus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Andre Basche",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/ea/8e/45479f9b7d2fa2743a23907ab5c9a6842f0fa53907d0676165c269fe8b8c/lidl-plus-0.3.5.tar.gz",
    "platform": "any",
    "description": "**This python package is unofficial and is not related in any way to Lidl. It was developed by reversed engineered requests and can stop working at anytime!**\n\n# Python Lidl Plus API\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Andre0512/lidl-plus/python-check.yml?branch=main&label=checks)](https://github.com/Andre0512/lidl-plus/actions/workflows/python-check.yml)\n[![PyPI - Status](https://img.shields.io/pypi/status/lidl-plus)](https://pypi.org/project/lidl-plus)\n[![PyPI](https://img.shields.io/pypi/v/lidl-plus?color=blue)](https://pypi.org/project/lidl-plus)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lidl-plus)](https://www.python.org/)\n[![PyPI - License](https://img.shields.io/pypi/l/lidl-plus)](https://github.com/Andre0512/lidl-plus/blob/main/LICENCE)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/lidl-plus)](https://pypistats.org/packages/lidl-plus)\n[![Buy Me a Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg)](https://www.buymeacoffee.com/andre0512)  \n\n\nFetch receipts and more from Lidl Plus.\n## Installation\n```bash\npip install lidl-plus\n```\n\n## Authentication\nTo login in Lidl Plus we need to simulate the app login.\nThis is a bit complicated, we need a web browser and some additional python packages.\nAfter we have received the token once, we can use it for further requestes and we don't need a browser anymore.\n\n#### Prerequisites\n* Check you have installed one of the supported web browser\n  - Chromium\n  - Google Chrome\n  - Mozilla Firefox\n  - Microsoft Edge\n* Install additional python packages\n  ```bash\n  pip install \"lidl-plus[auth]\"\n  ```\n#### Commandline-Tool\n```bash\n$ lidl-plus auth\nEnter your language (de, en, ...): de\nEnter your country (DE, AT, ...): AT\nEnter your lidl plus username (phone number): +4915784632296\nEnter your lidl plus password:\nEnter the verify code you received via phone: 590287\n------------------------- refresh token ------------------------\n2D4FC2A699AC703CAB8D017012658234917651203746021A4AA3F735C8A53B7F\n----------------------------------------------------------------\n```\n\n#### Python\n```python\nfrom lidlplus import LidlPlusApi\n\nlidl = LidlPlusApi(language=\"de\", country=\"AT\")\nlidl.login(phone=\"+4915784632296\", password=\"password\", verify_token_func=lambda: input(\"Insert code: \"))\nprint(lidl.refresh_token)\n```\n## Usage\nCurrently, the only features are fetching receipts and activating coupons\n### Receipts\n\nGet your receipts as json and receive a list of bought items like:\n```json\n{\n    \"currentUnitPrice\": \"2,19\",\n    \"quantity\": \"1\",\n    \"isWeight\": false,\n    \"originalAmount\": \"2,19\",\n    \"name\": \"Vegane Frikadellen\",\n    \"taxGroup\": \"1\",\n    \"taxGroupName\": \"A\",\n    \"codeInput\": \"4023456245134\",\n    \"discounts\": [\n        {\n            \"description\": \"5\u20ac Coupon\",\n            \"amount\": \"0,21\"\n        }\n    ],\n    \"deposit\": null,\n    \"giftSerialNumber\": null\n},\n```\n\n#### Commandline-Tool\n```bash\n$ lidl-plus --language=de --country=AT --refresh-token=XXXXX receipt --all > data.json\n```\n\n#### Python\n```python\nfrom lidlplus import LidlPlusApi\n\nlidl = LidlPlusApi(\"de\", \"AT\", refresh_token=\"XXXXXXXXXX\")\nfor receipt in lidl.tickets():\n    pprint(lidl.ticket(receipt[\"id\"]))\n```\n\n### Coupons\n\nYou can list all coupons and activate/deactivate them by id\n```json\n{\n    \"sections\": [\n        {\n            \"name\": \"FavoriteStore\",\n            \"coupons\": []\n        },\n        {\n            \"name\": \"AllStores\",\n            \"coupons\": [\n                {\n                    \"id\": \"2c9b3554-a09c-412c-8be4-d41cbff13572\",\n                    \"image\": \"https://lidlplusprod.blob.core.windows.net/images/coupons/LT/IDISC0000254911.png?t=1695452076\",\n                    \"type\": \"Standard\",\n                    \"offerTitle\": \"1 + 1\",\n                    \"title\": \"\ud83d\udc68\ud83c\udffb\u200d\ud83c\udf73 Frozen \ud83d\udc68\ud83c\udffb\u200d\ud83c\udf73\",\n                    \"offerDescriptionShort\": \"FREE\",\n                    \"isSegmented\": false,\n                    \"startValidityDate\": \"2023-09-24T21:00:00Z\",\n                    \"endValidityDate\": \"2023-10-01T20:59:59Z\",\n                    \"isActivated\": false,\n                    \"apologizeText\": \"Xxxxxxxxxxxxxxxxx\",\n                    \"apologizeStatus\": false,\n                    \"apologizeTitle\": \"Xxxxxxxxxxxxxxxxxxx\",\n                    \"promotionId\": \"DISC0000254911\",\n                    \"tagSpecial\": \"\",\n                    \"firstColor\": \"#ffc700\",\n                    \"secondaryColor\": null,\n                    \"firstFontColor\": \"#4a4a4a\",\n                    \"secondaryFontColor\": null,\n                    \"isSpecial\": false,\n                    \"hasAsterisk\": false,\n                    \"isHappyHour\": false,\n                    \"stores\": []\n                },\n                .......\n            ]\n        },\n        {\n            \"name\": \"OtherStores\",\n            \"coupons\": []\n        }\n    ]\n}\n```\n\n#### Commandline-Tool\n\nActivate all available coupons\n\n```bash\n$ lidl-plus --language=de --country=AT --refresh-token=XXXXX coupon --all\n```\n\n#### Python\n```python\nfrom lidlplus import LidlPlusApi\n\nlidl = LidlPlusApi(\"de\", \"AT\", refresh_token=\"XXXXXXXXXX\")\nfor section in lidl.coupons()[\"sections\"]:\n  for coupon in section[\"coupons\"]:\n    print(\"found coupon: \", coupon[\"title\"], coupon[\"id\"])\n```\n\n## Help\n#### Commandline-Tool\n```commandline\nLidl Plus API\n\noptions:\n  -h, --help                show this help message and exit\n  -c CC, --country CC       country (DE, BE, NL, AT, ...)\n  -l LANG, --language LANG  language (de, en, fr, it, ...)\n  -u USER, --user USER      Lidl Plus login username\n  -p XXX, --password XXX    Lidl Plus login password\n  --2fa {phone,email}       choose two factor auth method\n  -r TOKEN, --refresh-token TOKEN\n                            refresh token to authenticate\n  --skip-verify             skip ssl verification\n  --not-accept-legal-terms  not auto accept legal terms updates\n  -d, --debug               debug mode\n\ncommands:\n  auth                      authenticate and get token\n  receipt                   output last receipts as json\n  coupon                    activate coupons\n```\n\n## Support\nIf you find this project helpful and would like to support its development, you can buy me a coffee! \u2615\n\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/andre0512)\n\nDon't forget to star the repository if you found it useful! \u2b50\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Fetch receipts and more from Lidl Plus",
    "version": "0.3.5",
    "project_urls": {
        "GitHub": "https://github.com/Andre0512/lidl-plus",
        "PyPI": "https://pypi.org/project/lidl-plus/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5a8459cfd6625fab43454b9939e73e26c4be2ec7f7641b86a3879f15873ebd42",
                "md5": "f86e26cb62d38dbe082de0e1e59b3b34",
                "sha256": "3a01c1fa88a02477aecf3cd402b6842318beeff1600cef6874f7209923bb5639"
            },
            "downloads": -1,
            "filename": "lidl_plus-0.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f86e26cb62d38dbe082de0e1e59b3b34",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11536,
            "upload_time": "2024-02-08T23:36:55",
            "upload_time_iso_8601": "2024-02-08T23:36:55.053440Z",
            "url": "https://files.pythonhosted.org/packages/5a/84/59cfd6625fab43454b9939e73e26c4be2ec7f7641b86a3879f15873ebd42/lidl_plus-0.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea8e45479f9b7d2fa2743a23907ab5c9a6842f0fa53907d0676165c269fe8b8c",
                "md5": "a29c86a4b5d229eff48bae15e832931c",
                "sha256": "a0c535115df5480609e5fd43715651b78e4f7297b2dff06145b2381f22223552"
            },
            "downloads": -1,
            "filename": "lidl-plus-0.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a29c86a4b5d229eff48bae15e832931c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10654,
            "upload_time": "2024-02-08T23:36:57",
            "upload_time_iso_8601": "2024-02-08T23:36:57.117161Z",
            "url": "https://files.pythonhosted.org/packages/ea/8e/45479f9b7d2fa2743a23907ab5c9a6842f0fa53907d0676165c269fe8b8c/lidl-plus-0.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-08 23:36:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Andre0512",
    "github_project": "lidl-plus",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "lidl-plus"
}
        
Elapsed time: 4.06671s