-
-
Notifications
You must be signed in to change notification settings - Fork 14
ValueError: Failed to parse SNlM0e nonce value from the response. Refresh the Gemini web page or access Gemini in a new incognito browser to resend cookies. If issue continues, export browser cookies, set manually. See auth section 3. #24
Comments
same |
This issue is not a package-level error; It is because Google has denied the request.This could mean your account has been temporarily blocked due to frequent requests or your IP has been banned. There are some methods you can try, but ultimately, it means you failed to obtain the correct authentication from the Gemini server. Consider different workarounds related to your account, IP, and country. Temporary blocks may render it unavailable for several hours or days, and it is important to use it in a way that does not exceed rate limiting. Possible actions include changing your IP and account. We cannot help as this is not a package-level error. Please actively report other issues and improve our package code. We always welcome contributors. |
thanks, but a new problem occured.
|
Firstly, try this codes as sequencially: from gemini import Gemini
GeminiClient = Gemini(auto_cookies=True)
GeminiClient = Gemini(auto_cookies=True, target_cookies = ["__Secure-1PSIDCC"])
GeminiClient = Gemini(auto_cookies=True, target_cookies = ["__Secure-1PSID", "__Secure-1PSIDTS"])
GeminiClient = Gemini(auto_cookies=True, target_cookies = ["__Secure-1PSIDCC", " __Secure-1PSID", "__Secure-1PSIDTS", "NID"])
response = GeminiClient.generate_content("Hello, Gemini. What's the weather like in Seoul today?")
print(response.payload) If you're still receiving a blank response or it's not working, try passing the entire cookie as a last resort. Reset Chrome by removing all login information and cookies, then export and share the entire cookie using one account on Chrome. Use a browser extension to export and pass the entire cookie. |
Thanks for your reply. I tried all the codes you provided, and even when I add cookies manaully, the error still exsits. I think it may have nothing to do with automated cookie collection. |
Realted this issue #14. I have a cookie set that works on one laptop for nearly a month, but not on another, only returning empty responses. It might need more handling related to RotateCookie and exceptions, but I'm too busy with important schedules to spend much time on it. Please share any solutions you find. I couldn't capture the nonce value with auto cookie but had no issues otherwise. It might be necessary to reset all data through logins and logouts in different environments and properly define it using the ExportCookie extension. Once I'm free, I plan to experiment with various accounts to find a solution. |
Hello! Is it possible to use the automatic collection option on a remote server without GUI? |
Very thanks |
Problem Fixed but new Problem is shown 😑🤣 ValueError: Failed to parse SNlM0e nonce value from the response. |
This is what I plan to fix. I will check RotateCookie endpoint! I have importanct interview tomorrow! Thus, I will fix that issue until next weekend. Try to check this code https://github.com/dsdanielpark/Gemini-API?tab=readme-ov-file Reqid may not be useful. |
OK very thanks for answering me:) |
Is there an update on this yet? I am also having the same issue |
I've got the same problem |
Have you tried using all the cookies after resetting all account information in the browser (if necessary, log out and erase all information)? |
Just tried it (removed all cookies and logged back in again), the same err:
This is my code:
|
@ilmal try another browser like Firefox or same |
Just tried with firefox, same err when I selected cookies manually, automatically. I use this version if that is relevant:
|
Same issue, Now i back to older version, it works smoothly |
Thank you, pushed it back to v2.2.1 and now I get another err:
I cant find an prev issue with this err, anyone know what causes this? |
In fact, there's no significant change in the logic used across versions. However, I've also observed that the same cookies work on one laptop but not on another. Thus, it might be beneficial to refresh and retry cookies in various environments. To reiterate, once the entire cookie set is established, it tends to remain stable on a single PC for a long time. galihmrd ilmal There has been no change in the auth token collection algorithm between versions 2.4.2 and 2.4.1, though there might be changes in the parsing method. You can check as follows: There are four parsing methods, and version 2.4.2 tries various parsing approaches. Therefore, ensure that the payload received before parsing is correct. from gemini import Gemini
cookies = {} # Cookies may vary by account or region. Consider sending the entire cookie file.
GeminiClient = Gemini(cookies=cookies) # You can use various args
response_text, response_status = GeminiClient.send_request("Hello, Gemini. What's the weather like in Seoul today?")
print(response_text) |
Now I'm using version 2.2.1 |
Could you kindly try to use version 2.4.1? Thank you! |
I tried using another laptop with another browser, but still got the same problem. Not sure what I can do to force a cookie refresh. |
I recommend trying the third method with a new browser and suggest attempting it locally rather than on servers like Colab. |
Hi, guys! Sorry, It's my mistake. I was busy to review my code and I found some mistake in recent version. Gemini API 2.4.2I may fixed this issue. Try to use pip install python-gemini-api==2.4.2 or
I will not close this issue, becuase it may occured by different reasons. |
I tried to run with v2.4.2 but get the same err:
The problem seems to be with your cookie sorter.
And with that I got past the err. So I think you remove more cookies that you should here. But I'm not quite all the way fixed yet. By running your code:
I get:
Which I still find a bit cryptic. But at least the cookie problem seems to be resolved by just passing all cookies from the auto collect! :) |
As stated in the readme, it's essential to experiment in various environments to determine where Most of the errors seem to occur due to the inability to reset cookies remaining in the browser or the presence of other account information in Chrome, although I haven't been able to confirm this due to time constraints. Nonetheless, I strongly believe that resetting the browser and manually updating the cookie values are crucial. (Refer to the last advice about using a different browser if unsure.) Firstly, regarding the issue with cookies, I have update "all" option in If you wish to experiment with the current cookie values, simply provide the desired cookie key values as arguments in the form of a 1D list to target_cookies=["__Secure-1PSID", "__Secure-1PSIDTS"]
GeminiClient = Gemini(auto_cookies=True, target_cookies=target_cookies) I have update "all" option of target_cookies variable in 3e41ced GeminiClient = Gemini(auto_cookies=True, target_cookies="all") Lastly, as you suggested, manually providing cookies is indeed crucial! However, it's advisable to completely log out of the browser to forcefully reset the cookie values. If handling this aspect with Chrome poses difficulty, consider using alternative browsers like Firefox or Brave and try using the "Export Cookie" extension! I strongly recommend exporting cookies through a browser other than Chrome. After reinstalling the cookie values manually, please give it a try. Sincere gratitude for your consistent feedback! |
Tried everything on this thread, still getting the issue:
|
Authentication issues are likely related to account or IP problems. Have you considered using a paid VPN or services like Crawbase, and have you tried passing all cookies? |
I tried incognito mode, and even tor browser (despite its sluggishness). I've also passed all the cookies manually. Still the same issue persists. |
Have you followed all the instructions in the authentication section?
Due to the multitude of factor involved, I’m unable to provide package-level debugging. It’s possible that regional, account, or IP-based factors are affecting functionality. |
Hello Again I'm using GeminiClient = Gemini(auto_cookies=True)
But I got this error :
if len(getattr(self, "cookies", {})) > 5:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
The text was updated successfully, but these errors were encountered: