andre0512 / lidl-plus Goto Github PK
View Code? Open in Web Editor NEWFetch receipts and more from Lidl Plus
License: MIT License
Fetch receipts and more from Lidl Plus
License: MIT License
Describe the bug
I'm not familiar with selenium at all, but lidl-plus auth
was reporting that I don't have firefox installed (I do). Removing executable_path
, firefox_binary
and firefox_profile
arguments from webdriver.Firefox()
in _init_firefox()
fixed this issue.
Expected behavior
I'm supposed to get a refresh token.
Environment (please complete the following information):
"It turns out that selenium-wire is no longer maintained as of January 2024 and the project depends on package blinker, specifically file blinker._saferef that is no longer available in latest blinker versions 1.8.0 and 1.8.1.
The solution is to add direct dependency on blinker<1.8.0 into your project in order to prevent selenium-wire from automatically downloading the latest blinker version."
Can be fixed by installing an older version with
pip install blinker==1.7.0
API works just fine afterwards
Hi , thanks for open sourcing your work.
I have some questions on how to use this script and what it can do ?
Can you might give a small explanation how to use it
Thanks
I would be most appreciative if an example in docs or in practical implementation would be shown on how to run code from the library inside a docker container (preferably with docker-compose).
When running it on a desktop computer seems no problem at all, I have spent an entire day on trying to dockerize the lib but I still didn't manage to run it on a ubuntu server.
Hi thank you for providing this API. It would be nice if there is method to get all coupons and also another method to activate this coupons.
Just letting you know that API version 1 became unavailable (at least here in NL), so I did some research, and here are the updated endpoints:
Ticket list
Old: https://tickets.lidlplus.com/api/v1/NL/tickets/list
New: https://tickets.lidlplus.com/api/v2/NL/tickets
You can use the query parameter pageNumber
to select the page of the paginated response, and onlyFavorite
(true/false) to filter by favourite status.
Ticket details
Old: https://tickets.lidlplus.com/api/v1/NL/tickets/{id}
New: https://tickets.lidlplus.com/api/v2/NL/tickets/{id}
Response data structure also slightly changed, for example records
in the list response is now tickets
instead.
Also, methods for these aren't currently implemented in your library, but you might be interested in them:
https://tickets.lidlplus.com/api/v2/NL/tickets/favorite
, with JSON body ["ticketidhere"]
https://tickets.lidlplus.com/api/v2/NL/tickets/unfavorite
, with JSON body ["ticketidhere"]
https://coupons.lidlplus.com/api/v2/NL
https://coupons.lidlplus.com/api/v2/NL/{id}
https://coupons.lidlplus.com/api/v1/NL/{id}/activation
There's a bunch more endpoints for announcements, store details, shopping lists, etc, I'll document them all at some point, but hopefully the above will save you some trouble fixing the current methods in your library.
Hi,
thanks for providing this nice package.
With feature #7 it's possible to automatically activate all coupons available to all markets. However, there may be coupons that are only available to the selected favorite market. In the app, this favorite market can be selected under settings.
Without setting a favorite market, the first part of the response of LidlPlusApi.coupons()
looks like this: {'name': 'FavoriteStore', 'coupons': []}
To automatically enable the coupons for the favorite market as well, it would be nice to support the selection of the favorite market per API.
By the way, in case someone runs into the same problem:
Some LIDL coupon names are not UTF-8 compliant. This may lead to such an error when printing the coupon name:
UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 1120: ordinal not in range(256)
Therefore, it might be worth sanitizing the string before using it further. For me, the following encoding of the string worked:
coupon["title"].encode('utf8', 'ignore')
It seems lidl's CDN is blocking python connecting.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): accounts.lidl.com:443
send: b'GET /.well-known/openid-configuration HTTP/1.1\r\nHost: accounts.lidl.com\r\nUser-Agent: python-requests/2.31.0\r\nAccept-Encoding: gzip, deflate, br, zstd\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n'
reply: 'HTTP/1.1 403 Forbidden\r\n'
header: Server: AkamaiGHost
header: Mime-Version: 1.0
header: Content-Type: text/html
header: Content-Length: 419
header: Expires: Sat, 30 Mar 2024 15:54:23 GMT
header: Date: Sat, 30 Mar 2024 15:54:23 GMT
header: Connection: close
DEBUG:urllib3.connectionpool:https://accounts.lidl.com:443 "GET /.well-known/openid-configuration HTTP/1.1" 403 419
Traceback (most recent call last):
File "/home/sd/venv/bin/lidl-plus", line 8, in <module>
sys.exit(start())
^^^^^^^
File "/home/sd/venv/lib/python3.11/site-packages/lidlplus/__main__.py", line 187, in start
main()
File "/home/sd/venv/lib/python3.11/site-packages/lidlplus/__main__.py", line 175, in main
print_refresh_token(args)
File "/home/sd/venv/lib/python3.11/site-packages/lidlplus/__main__.py", line 114, in print_refresh_token
lidl_plus = lidl_plus_login(args)
^^^^^^^^^^^^^^^^^^^^^
File "/home/sd/venv/lib/python3.11/site-packages/lidlplus/__main__.py", line 92, in lidl_plus_login
lidl_plus.login(
File "/home/sd/venv/lib/python3.11/site-packages/lidlplus/api.py", line 215, in login
browser.get(self._register_link)
^^^^^^^^^^^^^^^^^^^
File "/home/sd/venv/lib/python3.11/site-packages/lidlplus/api.py", line 158, in _register_link
return f"{self._register_oauth_client()}&{params}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sd/venv/lib/python3.11/site-packages/lidlplus/api.py", line 73, in _register_oauth_client
client.provider_config(self._AUTH_API)
File "/home/sd/venv/lib/python3.11/site-packages/oic/oauth2/__init__.py", line 1173, in provider_config
raise CommunicationError("Trying '%s', status %s" % (url, r.status_code))
oic.exception.CommunicationError: Trying 'https://accounts.lidl.com/.well-known/openid-configuration', status 403
Note that accessing the same URL from a browser works fine. Taking the headers from the browser and running the request via cURL doesn't work. Running the request via wget works. Changing user agents doesn't seem to solve it.
TL:DR: This is probably some tls fingerprinting level anti-bot protection. It's hard to bypass. Search 'AkamaiGHost 403' on Google to find others with the same issue. I tried some of the proposed fixes with no luck.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.