-
-
Notifications
You must be signed in to change notification settings - Fork 527
Exception: SNlM0e value not found. Double-check __Secure-1PSID value or pass it as token='xxxxx'. #155
Comments
bard = Bard(token=token)
|
It may seem like I'm giving a repetitive answer, but this is not an issue that can be resolved externally.I have checked that the functionality of the Bard API is working properly. Please check if there have been any account locks or policy changes from Google for your Google account or in your region. Since the error is not reproducible and it is likely related to policies within Google's internal API interface, I cannot assist further. Please consider sharing information with others who might be experiencing similar issues. Furthermore, as this appears to be a duplicate issue #99 |
i have faced the same issue it happens when the cookie value(email acc) used too many times and can be resolved by using all additional cookie values (I noticed this after inspecting the bard chat) |
recently attempted to fix this after index out of range error. Now I'm getting this error. |
use another email it can be resolved |
I was able to solve it by wiping all cookies for |
After a few more usages on the same account, the same error pops up apparently, so maybe using another account is the better solution here (until that one gets the same error?). |
yup it also works i aleady use incoginto to get cookies so no need of wiping cookies |
I tried the way that is i deleted my account and cookies and tried again log in , it started working as usual but like after few moment again it got sucked . so i printed the error ###: Response Error: b')]}'\n\n38\n[["wrb.fr",null,null,null,null,[7]]]\n56\n[["di",32],["af.httprm",31,"-5444954100482431325",21]]\n25\n[["e",4,null,null,131]]\n'. Checking network environment or account , what is it trying to say . well i am from India , how can i find i am restricted , what this response means . |
Actually i did the same used another account used its psid but again same issue rised |
It's because Bard has updated it's policy and settings for different regions. Here's how you can fix this. (Work's for India, might not work for users from different nations, but do give it a try) In you session object set the following cookies as well as add the following headers.
and then, pass this in the Bard like this, make sure to pass the token value as bard __Secure-1PSID token only and timeout is optional
|
Does not work apparently in Germany: Traceback (most recent call last):
File "/Users/dima/Developer/dotfiles/python/chatbots/bard.py", line 30, in <module>
timeout=30).get_answer(sys.argv[1]))
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/bardapi/core.py", line 119, in get_answer
"content": parsed_answer[0][0],
~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable |
can u share your code? |
You need to upgrade package. Check if the package version is
|
yup maybe that's the issue @Dima-369 , or else try to share your code. |
Ah, thanks guys. Yeah, that was the issue, works now! |
Great, looks like the solution works for India as well Germany, 193 more to go lol 🤣 |
Hey guys... It was already implemented.... Could you please read the readme... However, it seems like valuable information for those who didn't know. Wishing everyone a good day. https://github.com/dsdanielpark/Bard-API/blob/main/documents/README_DEV.md#multi-cookie-bard However, for more efficient usage with reusable sessions, it is recommended to use the code provided by hitesh22rana above. import requests
from bardapi import Bard, SESSION_HEADERS
session = requests.Session()
token = "bard __Secure-1PSID token"
session.cookies.set("__Secure-1PSID", "bard __Secure-1PSID token")
session.cookies.set( "__Secure-1PSIDCC", "bard __Secure-1PSIDCC token")
session.cookies.set("__Secure-1PSIDTS", "bard __Secure-1PSIDTS token")
session.headers = SESSION_HEADERS
bard = Bard(token=token, session=session)
bard.get_answer("How is the weather today in seoul?") |
So coming to conclusion : When you import cookie from bard after 7-12 try like after 10-15 min , code again raise the same error. i tried my best to manipulate its heart code. After few attempts same issue came. Google has restricted traffic IPs i guess no third party bridge is working . In India , Neither @acheong08 nor @dsdanielpark module is permanently serving. Its because of googles policies . can you check once if still working . Daniel mentioned same issues in readme . |
just checked, it's not working now 😢 |
Hmm gotch u ! Let google update bard. Possible that they may change policy |
i found this in the doc it worked
|
works for me |
I encountered the following self-explanatory error:
and I solved editing the cookie's dictionary in the following way because of the cookie's change `from bardapi import BardCookies cookie_dict = { bard = BardCookies(cookie_dict=cookie_dict) |
{
|
Check this code. import requests
from bardapi import Bard, SESSION_HEADERS
session = requests.Session()
token = "bard __Secure-1PSID token"
session.cookies.set("__Secure-1PSID", "bard __Secure-1PSID token")
session.cookies.set( "__Secure-1PSIDCC", "bard __Secure-1PSIDCC token")
session.cookies.set("__Secure-1PSIDTS", "bard __Secure-1PSIDTS token")
session.headers = SESSION_HEADERS
bard = Bard(token=token, session=session)
bard.get_answer("How is the weather today in seoul?") |
This is working solution thanks. But we are creating applications over this API and we cannot ask user to enter multiple keys from Google Bard I hope you got what I am trying to say here. |
You're right. This project was developed to assist in mocking some functionalities, as extending bard has been challenging for quite a while, even after the experimental version deployment (there still isn't a fully open official API). However, with the recent development of a robust proxy server by the proxy provider, mocking various functionalities should become easier. |
Any solution? |
Use different account then. |
Why don't you update the READ.ME with the information of this ticket? |
Most of the details are described in README.md and README_DEV.md. Is there anything specific you believe needs additional updates, and if so, what is the reason? As you may know, with APIs, there can be new errors due to unstructured issues and various interface changes. Especially in the case of services like BARD, which have different architectures depending on the country, region, and language, many users may encounter different errors and new ones. We have tried to document the errors that can be standardized as much as possible, and marking similar user experiences can also be very helpful for developers in understanding the package. If you have more specific solutions or improvement suggestions, please let us know, and we would appreciate it. This issue is also identical to Issue #99, but we are keeping it open to share various perspectives and situations from different people. |
I would prefer using PALM API now its totaly free and easy to use. |
Yes its open to use and totally free i am using its pretty fast. |
it's worked for me first, after several times, it failed ! |
Did anybody find a working solution meanwhile? |
Hey guys after looking a bit into the problem the error SNlM0e value not found you can hard code the value simple go into browser make request to https://bard.google.com/ and then get the SNlM0e edit the modules code
|
Maybe the dev should add option for hard coded snim0e value too |
Few things to mention In headers you need X-Client-Data and you should be good |
@vibheksoni I couldn't find it in the headers. Which request exactly? I checked |
Im talking about request to streamGenerate |
@vibheksoni I see.
Also, cookie_dict method sometimes works. Sometimes, it's not. It is not stable. |
Oh ok yea I was trying all these solutions then I started looking at the modules code and the sites network tab and those helped me not get any errors or captcha. The problem is that there is a captcha task when I displayed the request contents. Im probably gonna write a version using selenium so I can solve or evade captcha for the most part. |
Got any success with latest bard with gemini ? |
#254 |
@SetoKaiba Thanks, I'll check it out |
Most underrated comment in this thread by far. I know it doesn't solve the potential issue with this library, but if you just need to get up and running I recommend Google's AI Studio. Navigate here to create an API key. Review the Python quickstart here. You'll be off to the races in no time. |
I highly recommended to pass clear variable like (‘token’=‘xxxxxx’) not (os.environ[‘_BARD_API’] = ‘xxxxxx’) Please refer official google api issue page. |
Please make sure to check for more efficient package management. *Please prioritize checking existing issues first. *
@dsdanielpark I tried every ways possible but getting a exception: Exception: SNlM0e value not found. Double-check __Secure-1PSID value or pass it as token='xxxxx'.
i checked the 1PSID value, I tried with other account, cleared browser and cookies .
Earlier this was working well but from 16 days its showing same error.
Please Try to solve this problem.
The text was updated successfully, but these errors were encountered: