Closed vipin211 closed 4 months ago
Occurs when response is not possible.
First, check if the Google Bard is officially in service. You need to access https://bard.google.com/ with your account and check if the result for the prompt is returned normally. If it is not an officially serviced area, the package will not work.
Second, check if you copied the value of __Secure-1PSID
correctly. Also, restart your browser and try again. It may be a non-response error due to an invalid cookie. __Secure-1PSID
values โโend with single a dot.
In case of response error due to server delay and use in proxy server, use timeout
or proxies
argument after version 0.1.3.
I've also found that the same error sometimes occurs during normal processes. Please give it some time or try resetting your cookie values manually.
If the same error is repeated even after checking all of the above, please tell me your Python environment, country, and region.
It also didn't work out for me. run locally on mac os, python 3.9, and got the following error:
{'content': 'Response Error: b\')]}\\\'\\n\\n38\\n[["wrb.fr",null,null,null,null,[9]]]\\n54\\n[["di",82],["af.httprm",82,"5948628323670192505",4]]\\n25\\n[["e",4,null,null,129]]\\n\'.'}
It also didn't work out for me. run locally on mac os, python 3.9, and got the following error:
{'content': 'Response Error: b\')]}\\\'\\n\\n38\\n[["wrb.fr",null,null,null,null,[9]]]\\n54\\n[["di",82],["af.httprm",82,"5948628323670192505",4]]\\n25\\n[["e",4,null,null,129]]\\n\'.'}
In the case of Response Error, it is returned when the key value is correct but the status value is not normal. (Occurs when status code is not 200
)
I get the same error when running the latest version from Git under Python 3.10.6 on Ubuntu
{'content': 'Response Error: b\')]}\\\'\\n\\n38\\n[["wrb.fr",null,null,null,null,[9]]]\\n55\\n[["di",99],["af.httprm",99,"8116501196847996776",10]]\\n25\\n[["e",4,null,null,130]]\\n\'.'}
I am logged into Bard on a separate machine (behind the same public IP) and able to talk to it.
I'm using a modified version of the jupyter-all-spark docker container and it does not work too,
from bardapi import Bard
import os
os.environ['_BARD_API_KEY'] = __Secure_1PSID
Bard().get_answer('How many people are living in USA?')['content']
Response:
'Response Error: b\')]}\\\'\\n\\n38\\n[["wrb.fr",null,null,null,null,[9]]]\\n57\\n[["di",139],["af.httprm",139,"7181192826173164579",13]]\\n25\\n[["e",4,null,null,132]]\\n\'.'
I got the same error message ๐ฅ
Response Error: b')]}\'\n\n38\n[["wrb.fr",null,null,null,null,[9]]]\n56\n[["di",152],["af.httprm",152,"-803832082914807468",2]]\n25\n[["e",4,null,null,131]]\n'.
run into a deepnote notebook with python 3.9 it is a linux console ๐ค
https://github.com/dsdanielpark/Bard-API/issues/1#issuecomment-1548705886, https://github.com/dsdanielpark/Bard-API/issues/1#issuecomment-1548449059, https://github.com/dsdanielpark/Bard-API/issues/1#issuecomment-1547699318, https://github.com/dsdanielpark/Bard-API/issues/1#issuecomment-1547298222
Addressing errors caused by delayed responses in environments like Google Colab and containers. If an error occurs despite following the proper procedure, utilize the timeout argument.
This issue was resolved with #6 merge. This has been resolved since bardapi==0.1.3.
from bardapi import Bard
import os
os.environ['_BARD_API_KEY']="xxxxxxxx"
bard = Bard(timeout=10) # Set timeout in seconds
bard.get_answer("๋์ ๋ด ๋๋
๋ฐฐ๋ค์ด ์ข์ํ๋ ๋ด์ง์ค์ ๋ํด์ ์๋ ค์ค")['content']
If you are working behind a proxy, use the following.
from bardapi import Bard
import os
os.environ['_BARD_API_KEY']="xxxxxxxx"
# Change 'http://127.0.0.1:1080' to your http proxy
# timeout in seconds
bard_inproxy = Bard(proxies={'http':'http://127.0.0.1:1080', 'https':'http://127.0.0.1:1080'}, timeout=10)
bard_inproxy.get_answer("๋์ ๋ด ๋๋
๋ฐฐ๋ค์ด ์ข์ํ๋ ๋ด์ง์ค์ ๋ํด์ ์๋ ค์ค")['content']
This is an error related to Google's internal authentication, so you should be able to talk to bard normally on the following site. If you can talk, try refreshing the cookies and trying again. Also, the bard service is currently available in limited areas only.
Please check this link. https://stackoverflow.com/questions/16230850/httpsconnectionpool-max-retries-exceeded
I have an issue with SSL certificate. requests.exceptions.SSLError: HTTPSConnectionPool(host='bard.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')))
Do you know how can I fix it?
Worked for me
Second, check if you copied the value of __Secure-1PSID correctly. Also, restart your browser and try again. It may be a non-response error due to an invalid cookie. __Secure-1PSID values โโend with single a dot.
ex) os.environ['__Secure-1PSID'] = VwhV4124qhvFp3nOm_sSsLszdr2u_DWm8otZBt3hPR9fud2BePGTk2jQmGmfcbKb_vyr3IjJFKEP.
It worked for me when I cleared my cookies and logged back in to Bard.
I was getting the same error. All I had to do was add bard_inproxy = Bard(timeout=10)
Something interesting I noticed, if I keep the original Korean text in the prompt I did not get the error... but replacing the original prompt with strictly English text gave me the error.
from bardapi import Bard
import os
os.environ['_BARD_API_KEY']='your __Secure-1PSID value'
bard_inproxy = Bard(timeout=10)
response = Bard().get_answer("meanining of life")['content']
print(response)
I was getting the same error. All I had to do was add
bard_inproxy = Bard(timeout=10)
Something interesting I noticed, if I keep the original Korean text in the prompt I did not get the error... but replacing the original prompt with strictly English text gave me the error.
Use this code.
from bardapi import Bard
import os
os.environ['_BARD_API_KEY']='your __Secure-1PSID value'
bard = Bard(timeout=10)
response = bard.get_answer("meanining of life")['content']
print(response)
I get a 'No module named "requests" ' error from the importation of Bard.
You may not have it installed.
https://pypi.org/project/requests/
On Wed, May 17, 2023 at 4:22 PM jay67nie @.***> wrote:
I get a 'No module named "requests" ' error from the importation of Bard.
โ Reply to this email directly, view it on GitHub https://github.com/dsdanielpark/Bard-API/issues/1#issuecomment-1552162507, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALF45H2UWXTNQRAHWMJ545DXGVFRJANCNFSM6AAAAAAYBL76DQ . You are receiving this because you commented.Message ID: @.***>
I get a 'No module named "requests" ' error from the importation of Bard.
pip install requests
It is included in the development version, but not included in the pypi version, so it has been included since version 0.1.5. thank you
Bard-API/bardapi/core.py", line 32, in _get_snim0e return re.search(r"SNlM0e":"(.*?)"", resp.text).group(1) AttributeError: 'NoneType' object has no attribute 'group'
You need to press Try Bard on bard.google.com
Which countries does Bard support?
Which countries does Bard support?
Bard's current official service area can be viewed at: https://support.google.com/bard/answer/13575153?hl=en
i have been getting the same issue
Traceback (most recent call last): File "/home/niran/.local/lib/python3.10/site-packages/flask/app.py", line 2213, in call return self.wsgi_app(environ, start_response) File "/home/niran/.local/lib/python3.10/site-packages/flask/app.py", line 2193, in wsgi_app response = self.handle_exception(e) File "/home/niran/.local/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "/home/niran/.local/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/niran/.local/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "/home/niran/.local/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/mnt/d/workingProjects/PaLmGPT-Nexus/app/routes.py", line 59, in chat bardresponse = bard.get_answer(prompt) File "/home/niran/.local/lib/python3.10/site-packages/bardapi/core.py", line 108, in get_answer parsed_answer[0][0] = self.translate(parsed_answer[0][0], self.language) File "/home/niran/.local/lib/python3.10/site-packages/bardapi/core.py", line 134, in translate return translator.translate(text, dest=translateto).text File "/home/niran/.local/lib/python3.10/site-packages/googletrans/client.py", line 174, in translate dest = dest.lower().split('', 1)[0] AttributeError: 'NoneType' object has no attribute 'lower'
Please uninstall the previous version of Googletrans as it is not included in the current Bard API. Install the latest version again, please.
pip install git+https://github.com/dsdanielpark/Bard-API.git
And test following code:
#pip install git+https://github.com/dsdanielpark/Bard-API.git
from bardapi import Bard
bard = Bard(token='xxxxxxxx', language='chinese (simplified)')
res = bard.get_answer("ไฝ ๅฅฝใ")
print(res['content'])
can the latest version - git+https://github.com/dsdanielpark/Bard-API.git
be exported to requirements.txt file and then installed with command - pip install -r requirements.txt
?
If you want to use Korean, English, and Japanese as mentioned in the README, you can simply use pip install bardapi
.
However, if you want to receive translated responses from Google Translate in various languages by passing the language parameter, you can install it using git+https://github.com/dsdanielpark/Bard-API.git
. You don't need to install any separate requirements.
However, using the GitHub version may result in slower performance because it involves two requests during the translation process.
Response Error: b')]}\'\n\n38\n[["wrb.fr",null,null,null,null,[8]]]\n54\n[["di",75],["af.httprm",75,"6198447553110271097",8]]\n25\n[["e",4,null,null,129]]\n'. [] i use the code. bard = Bard(token=token,proxies={'http':'http://127.0.0.1:7890', 'https':'http://127.0.0.1:7890'}, timeout=10) however i still meet the error,what should i do?
@dsdanielpark
Is there any known frequency of receiving "response errors" after 30-40 requests(rate limit to execute statement)? I have also attempted to reset the cookies, but unfortunately, I have not any success so far.
I tried
In any case, this Python package is not an official Bard API. In addition, since the cookie value is eventually bound and recorded in your Google account, sending a large number of requests may limit the use of the service.
i know .thank you.
... @.***
------------------ ๅๅง้ฎไปถ ------------------ ๅไปถไบบ: "Daniel @.>; ๅ้ๆถ้ด: 2023ๅนด5ๆ24ๆฅ(ๆๆไธ) ๆไธ10:37 ๆถไปถไบบ: @.>; ๆ้: @.>; @.>; ไธป้ข: Re: [dsdanielpark/Bard-API] Problem when executing Bard().get_answer(...) (Issue #1)
chavarera
In any case, this Python package is not an official Bard API. In addition, since the cookie value is eventually bound and recorded in your Google account, sending a large number of requests may limit the use of the service.
โ Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
This error still occurs for me.
{'content': 'Response Error: b\')]}\\\'\\n\\n38\\n[["wrb.fr",null,null,null,null,[9]]]\\n54\\n[["di",65],["af.httprm",64,"5086034706703496976",9]]\\n25\\n[["e",4,null,null,129]]\\n\'.'}
I am using the github developer version (pip install git+https://github.com/dsdanielpark/Bard-API.git
), I tried using the other (pip install bardapi
version too by uninstalling this one and using that but i still get the error
I tried AsyncBard and Bard both
have no idea.google limit the times to use .
... @.***
------------------ ๅๅง้ฎไปถ ------------------ ๅไปถไบบ: "dsdanielpark/Bard-API" @.>; ๅ้ๆถ้ด: 2023ๅนด6ๆ4ๆฅ(ๆๆๅคฉ) ๅๆจ3:56 @.>; @.**@.>; ไธป้ข: Re: [dsdanielpark/Bard-API] Problem when executing Bard().get_answer(...) (Issue #1)
This error still occurs for me.
{'content': 'Response Error: b\')]}\\'\n\n38\n[["wrb.fr",null,null,null,null,[9]]]\n54\n[["di",65],["af.httprm",64,"5086034706703496976",9]]\n25\n[["e",4,null,null,129]]\n\'.'}
I am using the github developer version (pip install git+https://github.com/dsdanielpark/Bard-API.git), I tried using the other (pip install bardapi version too by uninstalling this one and using that but i still get the error
I tried AsyncBard and Bard both
โ Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
In my case, I have logged in multiple google account, the token does not work. After using Incognito mode and login with single google account only, the token on this mode work fine
I am also facing issue when I am hosting the app in streamlit. But it works completely fine on localhost.
While i host in streamlit , i got
Response Error: b')]}'\n\n38\n[["wrb.fr",null,null,null,null,[9]]]\n57\n[["di",239],["af.httprm",239,"-7873719745301190719",0]]\n25\n[["e",4,null,null,132]]\n'.
Any fixes?
@Saugatkafley
Same error occurs for me. I am deploying app with Streamlit Cloud Community and using bardapi==0.1.11
It has not been solved yet, after clearing cookies by restarting Bard.
@thispath98 Can anything be done? Like i dont understand whats the problem. It could be of some internal proxies used by streamlit ?
If someone understand please mention what could have gone wrong ?
Do you know any other platforms like streamlit ?
There is a Google site request check and limit.
I think the problem will occur more often :( - I've received the same errors in IDE + via Bard over my web browser using VPN of course - because in my country the Bard service is unavailable.
At the moment, I do not have a solution for these limitations and I think we will have to wait for an official Bard API
I had the following code snippet in my code :
def generate_response(prompt): bard = Bard(token=token) response = bard.get_answer(prompt)['content'] return response
And I was getting this error. Initially it all went good without any such errors, but now IDK why is it happening. Tried clearing cookies and replacing the _Secure-1PSID token value, but nothing worked. Is that because I exceeded my maximum tries? If that's the case, Bard is working fine for me on the other hand. Help me out please...
TypeError: 'NoneType' object is not subscriptable File "C:\Users\Hemanth\AppData\Local\Programs\Python\Python311\Lib\site-packages\bardapi\core.py", line 119, in get_answer "content": parsed_answer[0][0]
I had the following code snippet in my code :
def generate_response(prompt): bard = Bard(token=token) response = bard.get_answer(prompt)['content'] return response
And I was getting this error. Initially it all went good without any such errors, but now IDK why is it happening. Tried clearing cookies and replacing the _Secure-1PSID token value, but nothing worked. Is that because I exceeded my maximum tries? If that's the case, Bard is working fine for me on the other hand. Help me out please...
TypeError: 'NoneType' object is not subscriptable File "C:\Users\Hemanth\AppData\Local\Programs\Python\Python311\Lib\site-packages\bardapi\core.py", line 119, in get_answer "content": parsed_answer[0][0]
I just got the exact same error. I checked Bard's activity and it seems like the questions are still being prompted.
Is that solved?
HemanthBunny jjsong23 Issue Solved.
TypeError: 'NoneType' object is not subscriptable
File "C:\Users\Hemanth\AppData\Local\Programs\Python\Python311\Lib\site-packages\bardapi\core.py", line 119, in get_answer
"content": parsed_answer[0][0]
Using version over 0.1.18
pip install bardapi>=0.1.18
Due to changes in the Google interface, a bug has been fixed in the temporary release of version 0.1.18. We are preparing for the release of version 0.1.19, which will include checks for the remaining features. Additionally, starting from version 0.1.18, the GitHub version of BardAPI will be synchronized with the PyPI version and released simultaneously.
In case the Google package is no longer available due to policy restrictions, here's a simple example code for using open-source language models (LLMs) in both English and multiple languages.
For the decoder models provided by Hugging Face, you can easily use them by either following a simple approach or overriding the inference method. You can explore various open-source language models at this link. Through the ranking information from Open LLM Leader Board Report repository, you can find information about good models.
other than English
from transllm import LLMtranslator
open_llama3b_kor = LLMtranslator('openlm-research/open_llama_3b', target_lang='ko', translator='google') # Korean
trnaslated_answer = open_llama3b_kor.generate("๋์ ๋ด ๋๋
๋ฐฐ๋ค์ด ์ข์ํ๋ ๋ด์ง์ค์ ๋ํด์ ์๋ ค์ค")
print(trnaslated_answer)
English
Refer https://github.com/openlm-research/open_llama or using like this:
from transllm import LLMtranslator
open_llama3b = LLMtranslator('openlm-research/open_llama_3b)
answer = open_llama3b.generate("Tell me about the Korean girl group Newjeans.")
print(answer)
I am also getting the same error. After sending few requests it starts throwing the error
/usr/local/lib/python3.10/dist-packages/bardapi/core.py in _get_snim0e(self) 126 snim0e = re.search(r"SNlM0e\":\"(.*?)\"", resp.text) 127 if not snim0e: --> 128 raise Exception( 129 "SNlM0e value not found. Double-check __Secure-1PSID value or pass it as token='xxxxx'." 130 )
Exception: SNlM0e value not found. Double-check __Secure-1PSID value or pass it as token='xxxxx'.
I did succeed in logging on Bard once, but later on I could never log on, though I updated and renewed cooies in Chrome and snippets. The errors are:Traceback (most recent call last):
File "path/file.py", line 403, in
My Snippets are:# # import os
# import bardapi
# import requests
# from bardapi.constants import SESSION_HEADERS
# from bardapi import Bard
# # print(bardapi.__version__)##0.1.38
# # os.environ['HTTP_PROXY'] = 'http://IP:PORT'
# # os.environ['HTTPS_PROXY'] = 'https://IP:PORT'
# # os.environ['_BARD_API_KEY'] = 'XXX.'
# token = "XXXX."
# session = requests.Session()
# session.headers = SESSION_HEADERS
# session.cookies.set("__Secure-1PSID", token)
# session.cookies.set("__Secure-1PSIDTS", "XXX")
# session.cookies.set("__Secure-1PSIDCC", "XXX")
# bard = Bard(token=token, session=session)
# res = bard.get_answer("Do you like cookies?")
# print(res)
Can anyone help me? Many thanks!
I am getting SSL certificate error: raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='bard.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')))
my code: from bardapi import Bard BARD_API_KEY ="xxxxxxx." bard = Bard(BARD_API_KEY) answer = bard.get_answer("what is the date today?")
Occurs when response is not possible.
First, check if the Google Bard is officially in service. You need to access https://bard.google.com/ with your account and check if the result for the prompt is returned normally. If it is not an officially serviced area, the package will not work.
- Visit https://bard.google.com/ and check if you are in the right state to talk to the bard. You need to press Try Bard on https://bard.google.com/
- Bard's current official service area can be viewed at: https://support.google.com/bard/answer/13575153?hl=en
Second, check if you copied the value of
__Secure-1PSID
correctly. Also, restart your browser and try again. It may be a non-response error due to an invalid cookie.__Secure-1PSID
values โโend with single a dot.
- ex) os.environ['__BARD_API_KEY'] = VwhV4124qhvFp3nOm_sSsLszdr2u_DWm8otZBt3hPR9fud2BePGTk2jQmGmfcbKb_vyr3IjJFKEP.
- In case of response error due to server delay and use in proxy server, use
timeout
orproxies
argument after version 0.1.3.I've also found that the same error sometimes occurs during normal processes. Please give it some time or try resetting your cookie values manually.
If the same error is repeated even after checking all of the above, please tell me your Python environment, country, and region.
Hey my __Secure-1PSID doesn't end with dot, why do you assert that? I had to do a workaround with BardCookies.
[NOTICE] Please, go to Gemini-API https://github.com/dsdanielpark/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.
[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.
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
Bard-API/bardapi/core.py", line 32, in _get_snim0e return re.search(r"SNlM0e\":\"(.*?)\"", resp.text).group(1) AttributeError: 'NoneType' object has no attribute 'group'