Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python no_kindle.py -e ${email} -p ${password} is not working. #129

Open
windbelike opened this issue Jul 1, 2023 · 19 comments
Open

python no_kindle.py -e ${email} -p ${password} is not working. #129

windbelike opened this issue Jul 1, 2023 · 19 comments

Comments

@windbelike
Copy link

Hey, thanks for creating this nice tool, but I got some problem using it.

Python version: Python 3.9.6
My ${email} and ${password} is correct, tested by myself.

After I do this:

python no_kindle.py -e ${email} -p ${password} is not working.

I got this error msg below, little help plz.

Could not retrieve auth tokens
Traceback (most recent call last):
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/no_kindle.py", line 5, in <module>
    no_main()
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/kindle_download_helper/no_cli.py", line 94, in no_main
    nk.make_library()
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 153, in make_library
    r = self.session.send(
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 40, in new_send
    return old_send(*args, **kwargs)
  File "/Users/sawyer/Library/Python/3.9/lib/python/site-packages/requests/sessions.py", line 684, in send
    kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env)
  File "/Users/sawyer/Library/Python/3.9/lib/python/site-packages/requests/utils.py", line 874, in resolve_proxies
    url = request.url
AttributeError: 'NoneType' object has no attribute 'url'
@yihong0618
Copy link
Owner

is it a amazon.cn account?

@yihong0618
Copy link
Owner

if it is amazon.com
you need add“—com”

@windbelike
Copy link
Author

is it a amazon.cn account?

yes, it is

@yihong0618
Copy link
Owner

yihong0618 commented Jul 1, 2023

unset your http_proxy and try again

unset http_proxy
unset https_proxy
maybe socks proxy either

@windbelike
Copy link
Author

unset your http_proxy and try again

unset http_proxy unset https_proxy maybe socks proxy either

I tried it, and it works the same.
What's more, I got this error while authenticating all the time.
BTW, I modify arb and request_id to 'x' while showing it here.

Authenticating . . .
{"response": {"challenge": {"challenge_reason": "HandleOnWebView", "uri": "https://www.amazon.cn/ap/challenge?arb=x"}}, "request_id": "x"}
Could not retrieve auth tokens
Traceback (most recent call last):
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/no_kindle.py", line 5, in <module>
    no_main()
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/kindle_download_helper/no_cli.py", line 94, in no_main
    nk.make_library()
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 153, in make_library
    r = self.session.send(
  File "/Users/sawyer/Desktop/repo/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 40, in new_send
    return old_send(*args, **kwargs)
  File "/Users/sawyer/Library/Python/3.9/lib/python/site-packages/requests/sessions.py", line 684, in send
    kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env)
  File "/Users/sawyer/Library/Python/3.9/lib/python/site-packages/requests/utils.py", line 874, in resolve_proxies
    url = request.url
AttributeError: 'NoneType' object has no attribute 'url'

@yihong0618
Copy link
Owner

interesting will dig into it
could you please nake sure you can login the web without any verification code then run the script again?

p.s. you can use the cookie way if you have a kindle

@windbelike
Copy link
Author

interesting will dig into it could you please nake sure you can login the web without any verification code then run the script again?

p.s. you can use the cookie way if you have a kindle

Sure, I just verified my email and password again by pasting the values from my terminal, then I login www.amazon.cn successfully.
I don't have a kindle though :)

@yihong0618
Copy link
Owner

interesting will dig into it could you please nake sure you can login the web without any verification code then run the script again?
p.s. you can use the cookie way if you have a kindle

Sure, I just verified my email and password again by pasting the values from my terminal, then I login www.amazon.cn successfully. I don't have a kindle though :)

so all things are fine?

@windbelike
Copy link
Author

No, Login manually in the web is fine, however the no_kindle.py command is still not working.

@Mosesofmason
Copy link

This could be due to the fact that you have enabled 2-step authentication. In order to use the script, I recommend temporarily disabling it. Once that's done, you should be able to download books. However, I suggest making some revisions to the "no_kindle.py" file so that it can accept the same arguments as "kindle.py".

@windbelike
Copy link
Author

This could be due to the fact that you have enabled 2-step authentication. In order to use the script, I recommend temporarily disabling it. Once that's done, you should be able to download books. However, I suggest making some revisions to the "no_kindle.py" file so that it can accept the same arguments as "kindle.py".

thanks for helping, but I did not enable the 2 - step authentication for my account, just checked my account configuration.

@yihong0618
Copy link
Owner

This could be due to the fact that you have enabled 2-step authentication. In order to use the script, I recommend temporarily disabling it. Once that's done, you should be able to download books. However, I suggest making some revisions to the "no_kindle.py" file so that it can accept the same arguments as "kindle.py".

thanks for the info.
And FYI
the reason we do not do this is kindle login method maybe ban by amazon that we can drop them easily(^-^)

@yihong0618
Copy link
Owner

This could be due to the fact that you have enabled 2-step authentication. In order to use the script, I recommend temporarily disabling it. Once that's done, you should be able to download books. However, I suggest making some revisions to the "no_kindle.py" file so that it can accept the same arguments as "kindle.py".

thanks for helping, but I did not enable the 2 - step authentication for my account, just checked my account configuration.

for the same args PR welcome^_^

@huanyusb
Copy link

huanyusb commented Jul 3, 2023

I have a similar issue:
Could not retrieve auth tokens
Traceback (most recent call last):
File "no_kindle.py", line 5, in
no_main()
File "/home/chy/Kindle_download_helper/kindle_download_helper/no_cli.py", line 94, in no_main
nk.make_library()
File "/home/chy/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 157, in make_library
tokens=self.tokens,
File "/home/chy/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 40, in new_send
return old_send(*args, **kwargs)
File "/home/chy/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
hooks = request.hooks
AttributeError: 'NoneType' object has no attribute 'hooks'

no proxies, no 2 steps authentication

@huanyusb
Copy link

huanyusb commented Jul 3, 2023

I have a similar issue: Could not retrieve auth tokens Traceback (most recent call last): File "no_kindle.py", line 5, in no_main() File "/home/chy/Kindle_download_helper/kindle_download_helper/no_cli.py", line 94, in no_main nk.make_library() File "/home/chy/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 157, in make_library tokens=self.tokens, File "/home/chy/Kindle_download_helper/kindle_download_helper/no_kindle.py", line 40, in new_send return old_send(*args, **kwargs) File "/home/chy/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 637, in send hooks = request.hooks AttributeError: 'NoneType' object has no attribute 'hooks'

no proxies, no 2 steps authentication

The scripts work almost fine after I updated the Python version to 3.10.

@youniverse-zhao
Copy link

It worked perfectly for me with Python 3.11.3. No proxy, no 2-step verification.

Many thanks and great job @yihong0618 !

@LanQ
Copy link

LanQ commented Jul 16, 2023

I got this, any ideas?

Authenticating . . .
Traceback (most recent call last):
  File "E:\git\Kindle_download_helper\no_kindle.py", line 5, in <module>
    no_main()
  File "E:\git\Kindle_download_helper\kindle_download_helper\no_cli.py", line 120, in no_main
    nk.make_library()
  File "E:\git\Kindle_download_helper\kindle_download_helper\no_kindle.py", line 178, in make_library
    ebooks = [e for e in ebooks if e["origins"]["origin"]["type"] == "Purchase"]
  File "E:\git\Kindle_download_helper\kindle_download_helper\no_kindle.py", line 178, in <listcomp>
    ebooks = [e for e in ebooks if e["origins"]["origin"]["type"] == "Purchase"]
TypeError: list indices must be integers or slices, not str

@yihong0618
Copy link
Owner

I got this, any ideas?

Authenticating . . .
Traceback (most recent call last):
  File "E:\git\Kindle_download_helper\no_kindle.py", line 5, in <module>
    no_main()
  File "E:\git\Kindle_download_helper\kindle_download_helper\no_cli.py", line 120, in no_main
    nk.make_library()
  File "E:\git\Kindle_download_helper\kindle_download_helper\no_kindle.py", line 178, in make_library
    ebooks = [e for e in ebooks if e["origins"]["origin"]["type"] == "Purchase"]
  File "E:\git\Kindle_download_helper\kindle_download_helper\no_kindle.py", line 178, in <listcomp>
    ebooks = [e for e in ebooks if e["origins"]["origin"]["type"] == "Purchase"]
TypeError: list indices must be integers or slices, not str

#134 (comment)

@afonw
Copy link

afonw commented Feb 2, 2024

Hi, I try the no_kindle.py, I checked my account setting, no 2FA on it.
the feedback of no_kindle.py --cn
Authenticating . . . {"response": {"challenge": {"challenge_reason": "InvalidAuthenticationData", "uri": "https://www.amazon.cn/ap/challenge?arb=55d67d3a-3f759c", "required_authentication_method": "GenericClaimPassword"}}, "request_id": "41cd8561153744e963"} Could not retrieve auth tokens Traceback (most recent call last): File "C:\Users\abcd\Kindle_download_helper\no_kindle.py", line 5, in <module> no_main() File "C:\Users\abcd\Kindle_download_helper\kindle_download_helper\no_cli.py", line 120, in no_main nk.make_library() File "C:\Users\abcd\Kindle_download_helper\kindle_download_helper\no_kindle.py", line 167, in make_library r = self.session.send( ^^^^^^^^^^^^^^^^^^ File "C:\Users\abcd\Kindle_download_helper\kindle_download_helper\no_kindle.py", line 45, in new_send return old_send(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abcd\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 684, in send kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abcd\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\utils.py", line 874, in resolve_proxies url = request.url ^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'url'

kndle.py --cn , It can list the books, but can't download them.
404 Client Error: Not Found for url: https://www.amazon.cn/error

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

No branches or pull requests

7 participants