Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

ValueError: too many values to unpack, how to fix it? #73

Closed
jr3074 opened this issue May 16, 2017 · 14 comments
Closed

ValueError: too many values to unpack, how to fix it? #73

jr3074 opened this issue May 16, 2017 · 14 comments

Comments

@jr3074
Copy link

jr3074 commented May 16, 2017

Start this month i got this error in many times, sometimes the api works great, but sometimes i got this.
Traceback (most recent call last): api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN) k, v = d.split("=") ValueError: too many values to unpack

Please help, how to fix it?

@4knahs
Copy link

4knahs commented May 18, 2017

Check googleplay.py somewhere around line 130 there is a split, replace it with this:

matchObj  = re.match("([^=]+)=(.*)",d)
k=matchObj.group(1)
v=matchObj.group(2)

Problem is that tokens can have the char '=' in them, so the split would return more than two values.

@jr3074
Copy link
Author

jr3074 commented May 18, 2017

so, i have to replace this
k, v = d.split("=")
with
matchObj = re.match("([^=]+)=(.*)",d) k=matchObj.group(1) v=matchObj.group(2)

?

@4knahs
Copy link

4knahs commented May 18, 2017

Yes, except you need some new lines there...

Replace the line:

k, v = d.split("=")

With these 3 lines:

matchObj  = re.match("([^=]+)=(.*)",d)
k=matchObj.group(1)
v=matchObj.group(2)

If you are not familiar with python note that code should be aligned.

@jr3074
Copy link
Author

jr3074 commented May 19, 2017

it works thanks

@p3r1c0
Copy link

p3r1c0 commented May 24, 2017

I have the same problem and I tryed with your suggest but I'm receiving the following error:
matchObj = re.match("([^=]+)=(.*)",d)
NameError: global name 're' is not defined

The code is the following:
for d in data:
if not "=" in d: continue
#raise LoginError("El valor de la variable antes de hacer el split es: " + d)
#k, v = d.split("=")
matchObj = re.match("([^=]+)=(.*)",d)
k=matchObj.group(1)
v=matchObj.group(2)
params[k.strip().lower()] = v.strip()
if "auth" in params:
#print("Auth-Token found: %s" % params["auth"])
self.setAuthSubToken(params["auth"])
elif "error" in params:
raise LoginError("server says: " + params["error"])
else:
raise LoginError("Auth token not found.")

Could you help me please? how I can fix it?

@4knahs
Copy link

4knahs commented May 24, 2017

Hola Pedro! :)

The error is explicit, there is no 're'.

It is the python regex library so you just need to import it on the top of the file : import re

@p3r1c0
Copy link

p3r1c0 commented May 24, 2017

Hola Mario,

Muchas gracias por tu rápida respuesta.

Veras, soy un estudiante de la Universidad de Baleares que esta haciendo un trabajo de fin de grado con la ayuda de esta herramienta.

El tema es que he implementado varios scripts usando las llamadas que proporciona este "crawler" y durante estos meses nunca había tenido ningún problema.

El problema es que como comenta el anterior usuario desde hace unos días recibo múltiples errores.

Es verdad que con lo que has comentados se ha solventado (disculpa mi anterior comentario) lo solvente rápidamente (me precipite preguntando).

El tema es que ahora, en la respuesta de la llamada, recibo mucha información (no necesaria) que antes no recibía. Por ejemplo, para la llamada de los permisos (véase el fichero .txt adjunto - (las primeras líneas no las tengas en cuenta son el resultado de intentar debuggear el código).

Como podrás ver recibo mucha información no necesaria y al final de la respuesta lo que si interesa (que era lo que devolvía antes).

¿Tienes alguna idea de que puede pasar? ¿O de como podría arreglarlo?

Muchas gracias por tu amabilidad.
prueba.txt

@4knahs
Copy link

4knahs commented May 24, 2017

Hi Pedro,

The APIs from google play (server side) are constantly changing and so is their return. Since the project maintainer is not around anymore either look for forks or alternative projects.

I only use this project for downloading apps so i cant comment on the data it retrieves. For retrieval i use the following: https://github.com/facundoolano/google-play-scraper

Look at this example: http://www.marioalmeida.eu/2017/03/01/700/

@p3r1c0
Copy link

p3r1c0 commented May 24, 2017

Hi Mario,

I'm sorry for my last spanish post, I thought that you was Spanish.

Many thanks for your help. But, I'm receiving (also) the following error :
'server says: BadAuthentication'
I'm confused about this, because usually the response is correct but sometimes I receive this error. Do you have this problem sometimes?

On the other hand, I could see your blog and I think that it's fantastic.

Would you mind if I ask you a few things about this? If you prefer I can to contact you for email.

Many thanks.

Regards,
Pedro

@4knahs
Copy link

4knahs commented May 25, 2017

The bad authentication is a recurring problem atm with this tool (1-2 out 3).

Perhaps try reusing the token you get via authentication, I havent debugged this yet.

You can use the blog message system, stackoverflow (and send link somehow) or (worst case scenario :P ) email...

@jr3074
Copy link
Author

jr3074 commented May 25, 2017

ya is also got this issue, bad auth problem but sometimes..
maybe there is new login method from google service?

@Murthysagi
Copy link

I got same error

usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:845: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
Traceback (most recent call last):
File "download.py", line 28, in
api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)
File "/root/Desktop/googleplay-api/googleplay.py", line 138, in login
raise LoginError("server says: " + params["error"])
googleplay.LoginError: u'server says: BadAuthentication'

@jr3074
Copy link
Author

jr3074 commented Jun 3, 2017

badauthentication is the current issue,, i also have this issue

@proxyblue
Copy link

@pedrogalindo @Murthysagi
BadAuthentication is solved #74

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants