matlink / gplaycli

Google Play Downloader via Command line
Other
1.01k stars 178 forks source link

Error in resolving matlink.fr is badly handled #203

Closed realityexists closed 5 years ago

realityexists commented 5 years ago

I WON'T ANSWER IF YOU DON'T PROVIDE SUCH DETAILS. COPY-PASTING IS NOT ENOUGH, I'M NOT A JEDI (YET).

Please provide those informations:

Running gplaycli -d someappid failed with the following errors:

cache file does not exists or is corrupted
Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "c:\program files\python36\lib\site-packages\urllib3\util\connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "c:\program files\python36\lib\socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "c:\program files\python36\lib\site-packages\urllib3\connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "c:\program files\python36\lib\site-packages\urllib3\connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "c:\program files\python36\lib\site-packages\urllib3\connection.py", line 301, in connect
    conn = self._new_conn()
  File "c:\program files\python36\lib\site-packages\urllib3\connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x00000000043F2748>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "c:\program files\python36\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "c:\program files\python36\lib\site-packages\urllib3\util\retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='matlink.fr', port=443): Max retries exceeded with url: /token/email/gsfid/bacon (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000043F2
748>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\Scripts\gplaycli-script.py", line 11, in <module>
    load_entry_point('GPlayCli==3.25', 'console_scripts', 'gplaycli')()
  File "c:\program files\python36\lib\site-packages\gplaycli\gplaycli.py", line 717, in main
    cli = GPlaycli(args, args.config)
  File "c:\program files\python36\lib\site-packages\gplaycli\gplaycli.py", line 152, in __init__
    self.token, self.gsfid = self.retrieve_token()
  File "c:\program files\python36\lib\site-packages\gplaycli\gplaycli.py", line 184, in retrieve_token
    response = requests.get(url)
  File "c:\program files\python36\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "c:\program files\python36\lib\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "c:\program files\python36\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\program files\python36\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "c:\program files\python36\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='matlink.fr', port=443): Max retries exceeded with url: /token/email/gsfid/bacon (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000000004
3F2748>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

This gives the user no idea what the problem is. With -v it gives a hint:

[INFO] GPlayCli version 3.25 [Python3.6.5]
[INFO] Configuration file is C:\Users\Rey/.config/gplaycli/gplaycli.conf
[INFO] Device is bacon
[ERROR] cache file does not exists or is corrupted
[INFO] Retrieving token ...
[INFO] Token URL is https://matlink.fr/token/email/gsfid/bacon

(then the same errors as above)

(My system was unable to resolve matlink.fr temporarily for some reason.) It would be nice to clearly report something like Unable to download URL "https://matlink.fr/token/email/gsfid/bacon" -> Failed to resolve "matlink.fr"

matlink commented 5 years ago

It is hard to handle every network issue that can happen and print nice messages.