Problem when executing Bard().get_answer(...)
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'
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-1PSIDcorrectly. Also, restart your browser and try again. It may be a non-response error due to an invalid cookie.__Secure-1PSIDvalues 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
timeoutorproxiesargument 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)
- 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.
- Bard's current official service area can be viewed at: https://support.google.com/bard/answer/13575153?hl=en
- In case of response error due to server delay and use in proxy server, it is possible after version 0.1.3.
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
Handling Delayed Response Errors in Environments like Google Colab and Containers
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.
If a response error occurs even though the normal procedure has been followed, use the timeout argument.
from bardapi import Bard
import os
os.environ['_BARD_API_KEY']="xxxxxxxx"
bard = Bard(timeout=10) # Set timeout in seconds
bard.get_answer("나와 내 동년배들이 좋아하는 뉴진스에 대해서 알려줘")['content']
Behind a proxy
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']
#5 #6
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=translate_to).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
- reset cookies
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'.