Comments (15)
@SPomodor please provide a more explantion..it will be very valuaeable.
from bard-api.
thanks, it worked. For some reason it works in combination with __Secure-ENID, I continue testing
from bard-api.
Same problem, no longer able to generate responses even after updating to bardapi==0.1.39
from bard-api.
Consider passing at least 3 cookie values. https://github.com/dsdanielpark/Bard-API/blob/main/documents/README_DEV.md#multi-cookie-bard
from bard-api.
@dsdanielpark Yes i looked into that, but the code example want the second cookie to be " __Secure-1PSIDTS " value but that cookie does not exist anymore.
If you look at the image i have attached to the main issue that is all cookies that exists now.
from bard-api.
mathisen99
Some users have reported that the cookie value does not end with a single dot, but there have been no additional issues.
Firstly, try experimenting with different cookie values to find a method that works correctly. Alternatively, you could use a VPN to bypass and set it to a different country or region, or try changing the nationality of the google account. Recently, Google seems to be taking a tough stance on bypassing with VPNs or changing countries, especially regarding YouTube Premium or other Google Cloud Services.
I apologize for the difficulty in debugging or finding a solution directly, as I cannot reproduce the error myself.
Unfortunately, there are no other ways I can help, except for developers facing similar challenges to find and share workarounds. As mentioned in the FAQ or README, sadly, the Bard-API package is an unofficial package and may become unusable at any time.
I will keep this issue open. Thank you.
from bard-api.
same problem, IP from Ukraine, Bard 0.1.38, but doesn’t work with 0.1.39 either, the cookie file requires it to end with .
from bard-api.
The message stating that it should end with a single dot in 0.1.39 version is merely a print statement for testing purposes, not an asset. You should pay attention to the next error message following this statement.
from bard-api.
OlegRuban-ai
What a nice.
I hope you find it! Please share with the other users.
from bard-api.
@dsdanielpark
Hi, I noticed that all the same cookies are needed to work (__Secure-1 PSID and __Secure-1PSIDTS). If you log in separately via selenium using these cookies, everything will work fine
from bard-api.
New documentation have been made for new args.
from bard-api.
After patching the library by removing the check if the __Secure-1PSID
cookie ends with a dot in bardapi/core.py (line 173) and bardapi/utils.py (line 106) the following code works for me (with firefox as browser)
from bardapi import Bard
bard = Bard(token_from_browser=True, multi_cookies_bool=True)
bard.get_answer("What is Bard?")
from bard-api.
it is working..But how to use bard api on a linux server having no web browser ..maybe i sounds stupid.
from bard-api.
I have found the solution for this.
But I think this only works with Firefox browser.
Here are the steps to use the latest Gemini AI through Bardapi with some kind of stability.
Install Firefox.
Sign in to Gemini (formerly Bard) with your google account credentials.
Unzip the updated files which are attached here and place it in the appropriate folders
Then you will be able to use bardapi seamlessly with the following code. Every time you run this code, it will extract the new cookies from firefox and send it to bardapi.
Make sure to pip install browser_cookie3.
import requests
from bardapi import SESSION_HEADERS, BardCookies
import browser_cookie3
domain = '.google.com'
firefox_cookies = browser_cookie3.firefox(domain_name=domain)
psid = '__Secure-1PSID'
dts = '__Secure-1PSIDTS'
dcc = '__Secure-1PSIDCC'
nid = 'NID'
psid_value = None
dts_value = None
dcc_value = None
nid_value = None
for cookie in firefox_cookies:
if cookie.name == psid:
psid_value = cookie.value
elif cookie.name == dts:
dts_value = cookie.value
elif cookie.name == dcc:
dcc_value = cookie.value
elif cookie.name == nid:
nid_value = cookie.value
cookie_dict = {
"__Secure-1PSID": psid_value,
"__Secure-1PSIDTS": dts_value,
"__Secure-1PSIDCC": dcc_value,
}
session = requests.Session()
session.cookies.set("__Secure-1PSID", psid_value)
session.cookies.set( "__Secure-1PSIDCC", dcc_value)
session.cookies.set("__Secure-1PSIDTS", dts_value)
session.cookies.set("NID",nid_value)
session.headers = SESSION_HEADERS
bard = BardCookies(session=session,cookie_dict=cookie_dict)
while True:
question = input("Enter your prompt to Gemini: ")
response = bard.get_answer(question)['content']
data = str(response).replace("*", "")
print(data)
from bard-api.
[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
from bard-api.
Related Issues (20)
- ChatBard: token_from_browser HOT 9
- ImportError: cannot import name 'BardCookies' from partially initialized module 'bardapi' (most likely due to a circular import) HOT 6
- Some code errors in README examples , os module import HOT 4
- Bard __SECURE-1PSID does not match HOT 2
- Exception: SNlM0e value not found. Double-check __Secure-1PSID value or pass it as Bard(token='xxxxx') HOT 1
- Google changed the the way "__Secure-1PSID" looks, how to use this package effectively,the cookie values does not end in '.' period now HOT 8
- Image generation HOT 4
- Google renames its chatbot Bard to Gemini HOT 41
- Gemini Ultra? HOT 4
- TooManyRedirects: Exceeded 30 redirects. HOT 1
- Check out this Bard/Gemini project. HOT 2
- Google changed their __Secure-1PSID value stracture HOT 2
- ask_about_image Not working HOT 2
- Cookies refreshing very often and getting 429 all the time HOT 2
- How can automaticly get cookies value in no gui servers? HOT 2
- Please, go to Gemini-API `https://github.com/dsdanielpark/Gemini-API`
- a conversation towards getting advance AI HOT 1
- Reflection on the Bard API Project
- Connecting Geminei to Ads HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bard-api.