Repsay / supermarket-mobile-api-connector

Simple connector for supermarket APIs
MIT License
4 stars 1 forks source link

Plus client is broken #17

Open PureTryOut opened 1 month ago

PureTryOut commented 1 month ago

It seems they totally removed the previous API, instantiating the Plus client currently fails:

>>> plus_client = Client()
Traceback (most recent call last):
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 196, in _new_conn
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/util/connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/socket.py", line 964, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -5] Name has no usable address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 490, in _make_request
    raise new_e
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 466, in _make_request
    self._validate_conn(conn)
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn
    conn.connect()
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 615, in connect
    self.sock = sock = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 203, in _new_conn
    raise NameResolutionError(self.host, self, e) from e
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0xfff621e753d0>: Failed to resolve 'pls-sprmrkt-mw.prd.vdc1.plus.nl' ([Errno -5] Name has no usable address)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 843, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 519, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pls-sprmrkt-mw.prd.vdc1.plus.nl', port=443): Max retries exceeded with url: /Due-away-are-Fight-Banq-Though-theere-Prayers-On?d=pls-sprmrkt-mw.prd.vdc1.plus.nl (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0xfff621e753d0>: Failed to resolve 'pls-sprmrkt-mw.prd.vdc1.plus.nl' ([Errno -5] Name has no usable address)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/supermarket_connector/nl/plus/__init__.py", line 177, in __init__
    self.login()
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/supermarket_connector/nl/plus/__init__.py", line 152, in login
    response: Response = requests.request(
                         ^^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bart/Downloads/tmp/.venv/lib/python3.12/site-packages/requests/adapters.py", line 700, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pls-sprmrkt-mw.prd.vdc1.plus.nl', port=443): Max retries exceeded with url: /Due-away-are-Fight-Banq-Though-theere-Prayers-On?d=pls-sprmrkt-mw.prd.vdc1.plus.nl (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0xfff621e753d0>: Failed to resolve 'pls-sprmrkt-mw.prd.vdc1.plus.nl' ([Errno -5] Name has no usable address)"))

Any clue how to resolve this @Repsay? Seems something new has to be made.

Repsay commented 1 month ago

I currently don't have the time to look into this. But the way you can find out is by decompiling the apk and looking through the source code to look for an url that they use now.