Debian Codegraph @

PKG-INFO

raw
1 Metadata-Version: 2.1
2 Name: python-picnic-api
3 Version: 1.1.0
4 Summary:
5 Home-page: https://github.com/MikeBrink/python-picnic-api
6 License: Apache-2.0
7 Author: Mike Brink
8 Author-email: [email protected]
9 Requires-Python: >=3.6,<4.0
10 Classifier: License :: OSI Approved :: Apache Software License
11 Classifier: Programming Language :: Python :: 3
12 Classifier: Programming Language :: Python :: 3.6
13 Classifier: Programming Language :: Python :: 3.7
14 Classifier: Programming Language :: Python :: 3.8
15 Classifier: Programming Language :: Python :: 3.9
16 Requires-Dist: requests (>=2.24.0,<3.0.0)
17 Project-URL: Repository, https://github.com/MikeBrink/python-picnic-api
18 Description-Content-Type: text/x-rst
19
20 """""""""""""""""
21 Python-Picnic-API
22 """""""""""""""""
23
24 .. image:: https://camo.githubusercontent.com/cd005dca0ef55d7725912ec03a936d3a7c8de5b5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275792532306d6525323061253230636f666665652d646f6e6174652d79656c6c6f772e737667
25 :target: https://www.buymeacoffee.com/MikeBrink
26 :alt: Buy me a coffee
27
28 Unofficial Python wrapper for the Picnic_ API. While not all API methods have been implemented yet, you'll find most of what you need to build a working application are available.
29
30 This library is not affiliated with Picnic and retrieves data from the endpoints of the mobile application. Use at your own risk.
31
32 .. _Picnic: https://picnic.app/nl/
33
34 ===============
35 Getting started
36 ===============
37 The easiest way to install is directly from pip::
38
39 $ pip install python-picnic-api
40
41
42 -----
43 Usage
44 -----
45 I'll go over a few common operations here you'll most likely use in applications.
46 To login:
47
48 .. code-block:: python
49
50 from python_picnic_api import PicnicAPI
51
52 picnic = PicnicAPI(username='username', password='password', country_code="NL")
53
54 The country_code parameter defaults to NL, but you have to change it if you live in a different country than the Netherlands (Germany: DE, Belgium: BE).
55 You can also store your credentials by setting the store value to true, this will store your credentials and country_code in /config/app.yaml.
56
57 Searching for a product
58 -----------------------
59 .. code-block:: python
60
61 >>> picnic.search('coffee')
62 [{'type': 'CATEGORY', 'id': 'coffee', 'links': [{'type': 'SEARCH', 'href': 'https://storefront-prod.nl.picnicinternational.com/api/15/search?search_term=coffee'}], 'name': 'coffee', 'items': [{'type': 'SINGLE_ARTICLE', 'id': '10511523', 'decorators': [{'type': 'UNIT_QUANTITY', 'unit_quantity_text': '500 gram'}], 'name': 'Lavazza espresso koffiebonen', 'display_price': 599, 'price': 599, 'image_id': 'd3fb2888fc41514bc06dfd6b52f8622cc222d017d2651501f227a537915fcc4f', 'max_count': 50, 'unit_quantity': '500 gram', 'unit_quantity_sub': '€11.98/kg', 'tags': []}, ...
63
64 Check cart
65 ----------
66 .. code-block:: python
67
68 >>> picnic.get_cart()
69 {'type': 'ORDER', 'id': 'shopping_cart', 'items': [], 'delivery_slots': [...
70
71
72 Manipulating your cart
73 ----------------------
74 All of these methods will return the shopping cart.
75
76 .. code-block:: python
77
78 # adding 2 'Lavazza espresso koffiebonen' to cart
79 picnic.add_product('10511523', count=2)
80
81 # removing 1 'Lavazza espresso koffiebonen' from cart
82 picnic.remove_product('10511523')
83
84 # clearing the cart
85 picnic.clear_cart()
86
87 See upcoming deliveries
88 ------------------------
89 .. code-block:: python
90
91 >>> picnic.get_current_deliveries()
92 []
93
94
95 See available delivery slots
96 ----------------------------
97 .. code-block:: python
98
99 >>> picnic.get_delivery_slots()
100
101