Giter VIP home page Giter VIP logo

lidl-plus's People

Contributors

1-byte avatar andre0512 avatar dakse avatar dependabot[bot] avatar vorostamas avatar woyken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lidl-plus's Issues

Cannot get refresh-token

After adding .items() inside the _register_link function in lidlplus/api.py here:

kép

I was able to navigate to the page, but after providing the e-mail and password, then hitting the next button nothing happened:

kép

Unable to get refresh token with Firefox

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):

  • Python-Version: 3.11
  • Release-Version: 0.2.6
  • OS: Fedora 37
  • Browser: Firefox and Chromium
  • Country: CZ
  • Language: cs

blinker._saferef Issue

"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

Suggestion: Dockerization

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.

API change

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:

  • Mark ticket (receipt) as favourite:
    POST https://tickets.lidlplus.com/api/v2/NL/tickets/favorite, with JSON body ["ticketidhere"]
  • Mark ticket (receipt) as not favourite:
    POST https://tickets.lidlplus.com/api/v2/NL/tickets/unfavorite, with JSON body ["ticketidhere"]
  • Coupon list: https://coupons.lidlplus.com/api/v2/NL
  • Coupon details: https://coupons.lidlplus.com/api/v2/NL/{id}
  • Coupon activation: POST (activate) or DELETE (deactivate) to 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.

Set Favorite Market

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')

HTTP 403 during auth

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.