Google changed the the way "__Secure-1PSID" looks, how to use this package effectively,the cookie values does not end in '.' period now
bhavik-malhotra opened this issue · comments
bug
So I have been using this python package for over 3 months now for my automation and it has been working great for me thanks @dsdanielpark for the amazing project. Recently I observed that the value of '__Secure-1PSID' has changed, the format of this cookie no longer has '.' at the end and looks compeletely different
I have updated the cookies re logged in and closed the browser etc.
So how do I make this work again.
Version
OS: Windows 11, tried on MacOS as well
Python: 3.11
Bard API: 0.1.38
Using proxy: NO
Error
raise Exception(
Exception: __Secure-1PSID value must end with a single dot. Enter correct __Secure-1PSID value.
Please use 0.1.39 for thie error. #261
Updated my bardapi version to 0.1.39
pip3 show bardapi
Name: bardapi
Version: 0.1.39
Summary: The python package that returns Response of Google Bard through API.
Home-page: https://github.com/dsdanielpark/Bard-API
Author: daniel park
Author-email: parkminwoo1991@gmail.com
License:
Location: C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages
Requires: colorama, httpx, requests
Required-by:
My Code
session = requests.Session()
session.headers = {
"Host": "bard.google.com",
"X-Same-Domain": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
"Origin": "https://bard.google.com",
"Referer": "https://bard.google.com/",
}
bard = Bard(token='g.*********COOKIE_NOT_ENDING_IN_DOT', session=session)
Error I get:
__Secure-1PSID value should end with a single dot. Enter correct __Secure-1PSID value.
Traceback (most recent call last):
File "C:\Users\Admin\Documents\Scripts\TwitterAuto\main.py", line 114, in <module>
bard = Bard(token='g.a000fwi.....xxxx',session=session)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\bardapi\core.py", line 80, in __init__
self.SNlM0e = self._get_snim0e()
^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\bardapi\core.py", line 160, in _get_snim0e
raise Exception(
Exception: SNlM0e value not found. Double-check __Secure-1PSID value or pass it as Bard(token='xxxxx')
I'm facing with this issue. I'm sure using version 0.1.39
I will check this issue, again.
I will check this issue, again.
I'm also facing the same issue for my project is there any solution for that new "Secure-1PSID" key value. .
[NOTICE] Please, go to Gemini-API https://github.com/dsdanielpark/Gemini-API
Google - Gemini API
A unofficial Python wrapper, python-gemini-api, operates through reverse-engineering, utilizing cookie values to interact with Google Gemini for users struggling with frequent authentication problems or unable to authenticate via Google Authentication.
Collaborated competently with Antonio Cheong.
What is Gemini?
[Paper] [Official Website] [Official API] [API Documents]
Gemini is a family of generative AI models developed by Google DeepMind that is designed for multimodal use cases. The Gemini API gives you access to the Gemini Pro and Gemini Pro Vision models. In February 2024, Google's Bard service was changed to Gemini.
Installation
pip install python-gemini-api
pip install git+https://github.com/dsdanielpark/Gemini-API.git
For the updated version, use as follows:
pip install -q -U python-gemini-api