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.
It seems lidl's CDN is blocking python connecting.
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.