# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['tgtg']

package_data = \
{'': ['*']}

install_requires = \
['requests==2.25.1']

setup_kwargs = {
    'name': 'tgtg',
    'version': '0.4.0',
    'description': 'Unoffical python client for TooGoodToGo API',
    'long_description': '[![Actions Status](https://github.com/ahivert/tgtg-python/workflows/CI/badge.svg)](https://github.com/ahivert/tgtg-python/actions)\n[![codecov](https://codecov.io/gh/ahivert/tgtg-python/branch/master/graph/badge.svg)](https://codecov.io/gh/ahivert/tgtg-python)\n[![PyPI version](https://img.shields.io/pypi/v/tgtg?color=blue)](https://pypi.org/project/tgtg/)\n\n# tgtg-python\n\nPython client that help you to talk with [TooGoodToGo](https://toogoodtogo.com) API.\n\nPython version: 3.6, 3.7, 3.8, 3.9\n\nHandle:\n- login (`/api/auth/v1/loginByEmail`)\n- list stores (`/api/item/`)\n- get a store (`/api/item/:id`)\n- set favorite (`/api/item/:id/setFavorite`)\n\nUsed by:\n- https://tgtg-notifier.com\n\n## Install\n\n```\npip install tgtg\n```\n\n## Use it\n\n### Build the client\n\n```python\nfrom tgtg import TgtgClient\n\n# login with email and password\nclient = TgtgClient(email=your_email, password=your_password)\n\n# or you can login with user_id and access_token\n# (you can retrieve them from client after logged with email and password)\nclient = TgtgClient(access_token=your_access_token, user_id=your_user_id)\n```\n\n### Get items\n\n```python\n# You can then get some items, by default it will *only* get your favorites\nclient.get_items()\n\n# To get items (not only your favorites) you need to provide location informations\nclient.get_items(\n    favorites_only=False,\n    latitude=48.126,\n    longitude=-1.723,\n    radius=10,\n)\n```\n\n<details>\n    <summary>Example response</summary>\n\n```python\n[\n    {\n        "item": {\n            "item_id": "64346",\n            "price": {"code": "EUR", "minor_units": 499, "decimals": 2},\n            "sales_taxes": [],\n            "tax_amount": {"code": "EUR", "minor_units": 0, "decimals": 2},\n            "price_excluding_taxes": {"code": "EUR", "minor_units": 499, "decimals": 2},\n            "price_including_taxes": {"code": "EUR", "minor_units": 499, "decimals": 2},\n            "value_excluding_taxes": {\n                "code": "EUR",\n                "minor_units": 1500,\n                "decimals": 2,\n            },\n            "value_including_taxes": {\n                "code": "EUR",\n                "minor_units": 1500,\n                "decimals": 2,\n            },\n            "taxation_policy": "PRICE_INCLUDES_TAXES",\n            "show_sales_taxes": False,\n            "value": {"code": "EUR", "minor_units": 1500, "decimals": 2},\n            "cover_picture": {\n                "picture_id": "110628",\n                "current_url": "https://images.tgtg.ninja/item/cover/2b69cbdd-43d3-4ade-bd51-50e338260859.jpg",\n            },\n            "logo_picture": {\n                "picture_id": "110618",\n                "current_url": "https://images.tgtg.ninja/store/fb893813-a775-4dec-ac7b-d4a7dd326fa8.png",\n            },\n            "name": "",\n            "description": "Salva comida en Ecofamily Bufé y tu pack podrá contener: comidas caseras.",\n            "can_user_supply_packaging": False,\n            "packaging_option": "MUST_BRING_BAG",\n            "collection_info": "",\n            "diet_categories": [],\n            "item_category": "MEAL",\n            "badges": [\n                {\n                    "badge_type": "SERVICE_RATING_SCORE",\n                    "rating_group": "LIKED",\n                    "percentage": 93,\n                    "user_count": 178,\n                    "month_count": 5,\n                }\n            ],\n            "favorite_count": 0,\n            "buffet": False,\n        },\n        "store": {\n            "store_id": "59949s",\n            "store_name": "Ecofamily Bufé - Centro",\n            "branch": "",\n            "description": "",\n            "tax_identifier": "",\n            "website": "",\n            "store_location": {\n                "address": {\n                    "country": {"iso_code": "ES", "name": "Spain"},\n                    "address_line": "Av. de los Piconeros, S/N, 14001 Córdoba, España",\n                    "city": "",\n                    "postal_code": "",\n                },\n                "location": {"longitude": -4.776045, "latitude": 37.894249},\n            },\n            "logo_picture": {\n                "picture_id": "110618",\n                "current_url": "https://images.tgtg.ninja/store/fb893813-a775-4dec-ac7b-d4a7dd326fa8.png",\n            },\n            "store_time_zone": "Europe/Madrid",\n            "hidden": False,\n            "favorite_count": 0,\n            "we_care": False,\n        },\n        "display_name": "Ecofamily Bufé - Centro",\n        "pickup_location": {\n            "address": {\n                "country": {"iso_code": "ES", "name": "Spain"},\n                "address_line": "Av. de los Piconeros, S/N, 14001 Córdoba, España",\n                "city": "",\n                "postal_code": "",\n            },\n            "location": {"longitude": -4.776045, "latitude": 37.894249},\n        },\n        "items_available": 0,\n        "distance": 4241.995584076078,\n        "favorite": True,\n        "in_sales_window": False,\n        "new_item": False,\n    },\n]\n```\n</details>\n\n### Get an item\n*(Using item_id from get_items response)*\n```python\nclient.get_item(item_id=64346)\n```\n\n<details>\n<summary>Example response</summary>\n\n```python\n{\n    "item": {\n        "item_id": "64346",\n        "price": {"code": "EUR", "minor_units": 499, "decimals": 2},\n        "sales_taxes": [],\n        "tax_amount": {"code": "EUR", "minor_units": 0, "decimals": 2},\n        "price_excluding_taxes": {"code": "EUR", "minor_units": 499, "decimals": 2},\n        "price_including_taxes": {"code": "EUR", "minor_units": 499, "decimals": 2},\n        "value_excluding_taxes": {"code": "EUR", "minor_units": 1500, "decimals": 2},\n        "value_including_taxes": {"code": "EUR", "minor_units": 1500, "decimals": 2},\n        "taxation_policy": "PRICE_INCLUDES_TAXES",\n        "show_sales_taxes": False,\n        "value": {"code": "EUR", "minor_units": 1500, "decimals": 2},\n        "cover_picture": {\n            "picture_id": "110628",\n            "current_url": "https://images.tgtg.ninja/item/cover/2b69cbdd-43d3-4ade-bd51-50e338260859.jpg",\n        },\n        "logo_picture": {\n            "picture_id": "110618",\n            "current_url": "https://images.tgtg.ninja/store/fb893813-a775-4dec-ac7b-d4a7dd326fa8.png",\n        },\n        "name": "",\n        "description": "Salva comida en Ecofamily Buf\\xc3\\xa9 y tu pack podr\\xc3\\xa1 contener: comidas caseras.",\n        "can_user_supply_packaging": False,\n        "packaging_option": "MUST_BRING_BAG",\n        "collection_info": "",\n        "diet_categories": [],\n        "item_category": "MEAL",\n        "badges": [\n            {\n                "badge_type": "SERVICE_RATING_SCORE",\n                "rating_group": "LIKED",\n                "percentage": 93,\n                "user_count": 178,\n                "month_count": 5,\n            }\n        ],\n        "favorite_count": 0,\n        "buffet": False,\n    },\n    "store": {\n        "store_id": "59949s",\n        "store_name": "Ecofamily Buf\\xc3\\xa9 - Centro",\n        "branch": "",\n        "description": "",\n        "tax_identifier": "",\n        "website": "",\n        "store_location": {\n            "address": {\n                "country": {"iso_code": "ES", "name": "Spain"},\n                "address_line": "Av. de los Piconeros, S/N, 14001 C\\xc3\\xb3rdoba, Espa\\xc3\\xb1a",\n                "city": "",\n                "postal_code": "",\n            },\n            "location": {"longitude": -4.776045, "latitude": 37.894249},\n        },\n        "logo_picture": {\n            "picture_id": "110618",\n            "current_url": "https://images.tgtg.ninja/store/fb893813-a775-4dec-ac7b-d4a7dd326fa8.png",\n        },\n        "store_time_zone": "Europe/Madrid",\n        "hidden": False,\n        "favorite_count": 0,\n        "items": [\n            {\n                "item": {\n                    "item_id": "64346",\n                    "price": {"code": "EUR", "minor_units": 499, "decimals": 2},\n                    "sales_taxes": [],\n                    "tax_amount": {"code": "EUR", "minor_units": 0, "decimals": 2},\n                    "price_excluding_taxes": {\n                        "code": "EUR",\n                        "minor_units": 499,\n                        "decimals": 2,\n                    },\n                    "price_including_taxes": {\n                        "code": "EUR",\n                        "minor_units": 499,\n                        "decimals": 2,\n                    },\n                    "value_excluding_taxes": {\n                        "code": "EUR",\n                        "minor_units": 1500,\n                        "decimals": 2,\n                    },\n                    "value_including_taxes": {\n                        "code": "EUR",\n                        "minor_units": 1500,\n                        "decimals": 2,\n                    },\n                    "taxation_policy": "PRICE_INCLUDES_TAXES",\n                    "show_sales_taxes": False,\n                    "value": {"code": "EUR", "minor_units": 1500, "decimals": 2},\n                    "cover_picture": {\n                        "picture_id": "110628",\n                        "current_url": "https://images.tgtg.ninja/item/cover/2b69cbdd-43d3-4ade-bd51-50e338260859.jpg",\n                    },\n                    "logo_picture": {\n                        "picture_id": "110618",\n                        "current_url": "https://images.tgtg.ninja/store/fb893813-a775-4dec-ac7b-d4a7dd326fa8.png",\n                    },\n                    "name": "",\n                    "description": "Salva comida en Ecofamily Buf\\xc3\\xa9 y tu pack podr\\xc3\\xa1 contener: comidas caseras.",\n                    "can_user_supply_packaging": False,\n                    "packaging_option": "MUST_BRING_BAG",\n                    "collection_info": "",\n                    "diet_categories": [],\n                    "item_category": "MEAL",\n                    "badges": [\n                        {\n                            "badge_type": "SERVICE_RATING_SCORE",\n                            "rating_group": "LIKED",\n                            "percentage": 93,\n                            "user_count": 178,\n                            "month_count": 5,\n                        }\n                    ],\n                    "favorite_count": 0,\n                    "buffet": False,\n                },\n                "display_name": "Ecofamily Buf\\xc3\\xa9 - Centro",\n                "pickup_location": {\n                    "address": {\n                        "country": {"iso_code": "ES", "name": "Spain"},\n                        "address_line": "Av. de los Piconeros, S/N, 14001 C\\xc3\\xb3rdoba, Espa\\xc3\\xb1a",\n                        "city": "",\n                        "postal_code": "",\n                    },\n                    "location": {"longitude": -4.776045, "latitude": 37.894249},\n                },\n                "items_available": 0,\n                "distance": 0.0,\n                "favorite": True,\n                "in_sales_window": False,\n                "new_item": False,\n            }\n        ],\n        "milestones": [\n            {"type": "MEALS_SAVED", "value": "500"},\n            {"type": "MONTHS_ON_PLATFORM", "value": "6"},\n        ],\n        "we_care": False,\n    },\n    "display_name": "Ecofamily Buf\\xc3\\xa9 - Centro",\n    "pickup_location": {\n        "address": {\n            "country": {"iso_code": "ES", "name": "Spain"},\n            "address_line": "Av. de los Piconeros, S/N, 14001 C\\xc3\\xb3rdoba, Espa\\xc3\\xb1a",\n            "city": "",\n            "postal_code": "",\n        },\n        "location": {"longitude": -4.776045, "latitude": 37.894249},\n    },\n    "items_available": 0,\n    "distance": 0.0,\n    "favorite": True,\n    "in_sales_window": False,\n    "new_item": False,\n}\n\n```\n\n</details>\n\n### Set favorite\n*(Using item_id from get_items response)*\n\n```python\n# add favorite\nclient.set_favorite(item_id=64346, is_favorite=True)\n\n# remove favorite\nclient.set_favorite(item_id=64346, is_favorite=False)\n```\n\n## Developers\n\nThis project uses poetry so you will need to install poetry locally to use following\ncommands.\n```\npip install poetry --user\npoetry install\n```\n\nThis project uses [pre-commit](https://pre-commit.com/) to format/check all the\ncode before each commit automatically.\n```\npip install pre-commit --user\npre-commit install\n```\n\nRun this command to run all tests:\n```\nmake test\n```\n',
    'author': 'Anthony Hivert',
    'author_email': 'anthony.hivert@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/ahivert/tgtg-python',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
