gplaycli icon indicating copy to clipboard operation
gplaycli copied to clipboard

apk version determination broken, -av, --append-version (was: Inconsistent failure of apk download with KeyError)

Open ford--prefect opened this issue 4 years ago • 4 comments

  • [ ] Operating System (ie Ubuntu 16.04): Archlinux
  • [ ] Python version when running gplaycli (should be 3+): python 3.9.2
  • [ ] GPlayCli version via gplaycli -v: 3.29
  • [ ] The way you installed gplaycli: AUR package (uses setup.py)
  • [ ] The authentication method: own credentials

I'm running gplaycli in download mode with a daily cron job, and inconsistently get failures of the following kind:

Traceback (most recent call last):
  File "/usr/bin/gplaycli", line 33, in <module>
    sys.exit(load_entry_point('gplaycli==3.29', 'console_scripts', 'gplaycli')())
  File "/usr/lib/python3.9/site-packages/gplaycli/gplaycli.py", line 659, in main
    cli.download(args.download)
  File "/usr/lib/python3.9/site-packages/gplaycli/hooks.py", line 11, in check_connection
    return function(self, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/gplaycli/gplaycli.py", line 257, in download
    filename = "%s-v.%s.apk" % (detail['docid'], detail['details']['appDetails']['versionString'])
KeyError: 'versionString'

This happens for all calls in one session, but not on all days. I guess, this is a problem with the playstore response, but maybe a check and graceful error or handling could be achieved?

ford--prefect avatar May 26 '21 13:05 ford--prefect

Same happen here on all tries, running /home/appuser/.local/bin/gplaycli -av -p -y -v -d com.trusteewallet error:

[INFO] GPlayCli version 3.29 [Python3.9.5] 
[INFO] Configuration file is /home/appuser/.local/etc/gplaycli/gplaycli.conf
[INFO] Device is bacon
[INFO] Using cached token.
[INFO] Using auto retrieved token to connect to API
Traceback (most recent call last):
  File "/home/appuser/.local/bin/gplaycli", line 8, in <module>
    sys.exit(main())
  File "/home/appuser/.local/lib/python3.9/site-packages/gplaycli/gplaycli.py", line 659, in main
    cli.download(args.download)
  File "/home/appuser/.local/lib/python3.9/site-packages/gplaycli/hooks.py", line 11, in check_connection
    return function(self, *args, **kwargs)
  File "/home/appuser/.local/lib/python3.9/site-packages/gplaycli/gplaycli.py", line 257, in download
    filename = "%s-v.%s.apk" % (detail['docid'], detail['details']['appDetails']['versionString'])
KeyError: 'versionString'

or error:

/ $ /home/appuser/.local/bin/gplaycli -av -p -y -v -d com.trusteewallet
[INFO] GPlayCli version 3.29 [Python3.9.5] 
[INFO] Configuration file is /home/appuser/.local/etc/gplaycli/gplaycli.conf
[INFO] Device is bacon
[Errno 2] No such file or directory: '/home/appuser/.cache/gplaycli/token'
[INFO] Cache file does not exists or is corrupted
[INFO] Retrieving token ...
[INFO] Token URL is https://matlink.fr/token
[INFO] Email: [email protected]
[INFO] Token: ya29.a0AfH6SMASh2qjvMwOtg45TuaWUYe1XNO49ApxOyOqJZoxT3jd7eWkLqWR6MEJXZdd__8BE7dU38dpyhb2Kchzk6V4eCQOlsQWMA5l6J83FyXb87t4oGIjKuKJlL1VEJ72X2D1-sk8K8Ja_aMVrUkw_SpbkJwUL8jcRJSJtqDWjXSXqncQ1FZgLQPZbla25TtVdZK7ObQuj6AgJyxGxIBy1YOknNGKMarkK-lrUKU3j2VN3wxB62UWzp7nocEXIGygWZDH7F3_bloj-5BvTJ9vsdN8f6wn1lMDWr3v-EQlkwZE_6F5Y4BRp2xEDp3XyIYx
[INFO] GsfId: 3123051ad8b7b3e0
[INFO] Using auto retrieved token to connect to API
Traceback (most recent call last):
  File "/home/appuser/.local/bin/gplaycli", line 33, in <module>
    sys.exit(load_entry_point('gplaycli==3.29', 'console_scripts', 'gplaycli')())
  File "/home/appuser/.local/lib/python3.9/site-packages/gplaycli/gplaycli.py", line 659, in main
    cli.download(args.download)
  File "/home/appuser/.local/lib/python3.9/site-packages/gplaycli/hooks.py", line 11, in check_connection
    return function(self, *args, **kwargs)
  File "/home/appuser/.local/lib/python3.9/site-packages/gplaycli/gplaycli.py", line 257, in download
    filename = "%s-v.%s.apk" % (detail['docid'], detail['details']['appDetails']['versionString'])
KeyError: 'versionString'

Enviroment can be reproduced as I run this tool from alpine container built by below ContainerFile:

build: podman build --pull --rm -t gplaycli -f ContainerFile run: podman run --rm --name gplaycli -ti gplaycli

FROM docker.io/alpine:edge

RUN set -ex; \
    apk update; \
    apk add --no-cache \
        rust \
        cargo \
        libffi-dev \
        python3-dev \
        libxslt-dev \
        libxml2-dev \
        openssl-dev \
        gcc \
        musl-dev \
        py3-pip; \
    adduser -D appuser;
    
USER appuser

RUN pip3 install -U gplaycli;

emanuelb avatar Jun 03 '21 00:06 emanuelb

Investigating this further reveals, that the version information is not returned (from google?) anymore, so determining the version number of the requested app fails. This renders the -av option broken. Leaving this option out brings me the well-known [DF-DFERH-01] error from #271

ford--prefect avatar Jun 09 '21 12:06 ford--prefect

@ford--prefect I wanted to know if there is any fix available or any workaround for this?

d78ui98 avatar Jun 27 '21 06:06 d78ui98

@d78ui98 yes, don't use the -av flag

ford--prefect avatar Jun 27 '21 14:06 ford--prefect