dsdanielpark / Bard-API

The unofficial python package that returns response of Google Bard through cookie value.
https://pypi.org/project/bardapi/
MIT License
5.32k stars 528 forks source link

Response Error: b')]}\\'\\n\\n38\\n[[\"wrb.fr\",null,null,null,null,[8]]]\\n54\\n[[\"di\",59],[\"af.httprm\",59,\"4239016509367430469\",0]]\\n25\\n[[\"e\",4,null,null,129]]\\n'. \nTemporarily unavailable due to traffic or an error in cookie values. Please double-check the cookie values and verify your network environment. #128

Closed leimeng86 closed 7 months ago

leimeng86 commented 1 year ago

Hi, there:

I encountered the response error using bardapi to ask_about_image:

"Response Error: b')]}\\'\\n\\n38\\n[[\"wrb.fr\",null,null,null,null,[8]]]\\n54\\n[[\"di\",59],[\"af.httprm\",59,\"4239016509367430469\",0]]\\n25\\n[[\"e\",4,null,null,129]]\\n'. \nTemporarily unavailable due to traffic or an error in cookie values. Please double-check the cookie values and verify your network environment."

Then I tried again the Bard UI, and got this warning message.

Is anyone seeing this warning message? And what can we do about it?

sachnun commented 1 year ago

upgrade package to the dev version, it's been fixed #125

dsdanielpark commented 1 year ago

Response Issues with Bard API

Response Error: b')]}\\'\\n\\n38\\n[[\"wrb.fr\",null,null,null,null,[8]]]\\n54\\n[[\"di\",59],
[\"af.httprm\",59,\"4239016509367430469\",0]]\\n25\\n[[\"e\",4,null,null,129]]\\n'. 
Temporarily unavailable due to traffic or an error in cookie values. Please double-check the cookie values and verify your network environment.

The error you're experiencing isn't originating from the package itself; it's related to your Google account and may be due to various factors like your country or region settings, which can prevent you from receiving accurate results from Bard. Therefore, it's beyond the scope of the package to resolve, but please consider checking the following:

  1. First, thoroughly read the readme and see if it pertains to cases of temporary abnormal responses from the package. Try again after some time or a few hours: Before using Bard API
  2. Bypass proxies: Behind a proxy
  3. Try using an account from a different region or change the language settings of your Google account.
  4. Restart your browser to refresh the cookie values and use the new __Secure-1PSID.
  5. Try passing three or more cookies using Multi-cookie Bard. If that doesn't work, consider passing almost all cookie values.

Please let me know if you need further assistance.

yihong0618 commented 1 year ago

Use dev version until update pypi version.

$ pip install git+https://github.com/dsdanielpark/Bard-API.git

pip install -U git+https://github.com/dsdanielpark/Bard-API.git

dsdanielpark commented 1 year ago

There could be various reasons for the recurring issue.

It is not a Bard-API package code error, I have conducted regular QA and CI for functionality.

This error is due to abnormal responses from Google's internal interfaces, such as regional/account/rate limiting policies. Therefore, it cannot be resolved within this package, and you may need to check the root cause in different environments.

You can try logging out or renewing cookies, bypassing other servers, or checking on platforms like Colab.

  1. Update BardAPI package (ensure the previous version is deleted).
    pip install -U git+https://github.com/dsdanielpark/Bard-API.git
  2. Refresh cookie values (log out, completely close the browser, then reopen and log in to use updated cookies).
  3. There might be rate limiting, so wait a few hours before trying again. Most users reported that the issue was resolved after following these steps.

Please share your user experience related to this error in issue #128. Thank you.

abalgir commented 1 year ago

Hello, It seems I have the same issue but in a different environment. I have a simple code that works perfectly on my local machine but generates an error when deployed on Streamlit. I am using the bardapi from GitHub - dsdanielpark/Bard-API: The unofficial python package that returns response of Google Bard through cookie value. and using the latest version. in requirements.txt I have bardapi==0.1.29

import streamlit as st
from dotenv.main import load_dotenv
import os
load_dotenv()
st.title("BardAPI for Python")

_BARD_API_KEY=os.environ['_BARD_API_KEY']
#import os
from bardapi import Bard

with st.container () :

    with st.spinner ( 'Wait till Bard gets the answers...' ) :
        input_text = "What is the largest state in the USA?"

        try :
            bard = Bard ( token = _BARD_API_KEY, timeout = 20 )
            response = (bard.get_answer ( input_text ) [ 'content' ])
            st.write ( response )
        except :
            st.error ( 'Please check if you have set the Cookie ' )

on the local machine, I get:

BardAPI for Python

The largest state in the USA is Alaska. It has a total area of 586,412 square miles, which is more than two and a half times the size of Texas, the second largest state. Alaska is also the least densely populated state in the USA, with a population of only about 733,000 people.

Here is a list of the 10 largest states in the USA, ranked by total area:

Alaska (586,412 square miles) Texas (268,596 square miles) California (163,695 square miles) Montana (147,046 square miles) New Mexico (121,590 square miles) Arizona (113,990 square miles) Nevada (110,572 square miles) Colorado (104,094 square miles) Oregon (98,379 square miles) Wyoming (97,813 square miles) I hope this helps! Let me know if you have any other questions.

on Streamlit Hub I get:

BardAPI for Python

Response Error: b’)]}‘\n\n38\n[[“wrb.fr”,null,null,null,null,[9]]]\n56\n[[“di”,163],[“af.httprm”,163,“7269046257447756350”,0]]\n25\n[[“e”,4,null,null,131]]\n’. Unable to get response. Please double-check the cookie values and verify your network environment or google account.

I am using the same cookie; nothing changed. Any help is appreciated. Thank you

vsynytsia commented 1 year ago

Hello, It seems I have the same issue but in a different environment. I have a simple code that works perfectly on my local machine but generates an error when deployed on Streamlit. I am using the bardapi from GitHub - dsdanielpark/Bard-API: The unofficial python package that returns response of Google Bard through cookie value. and using the latest version. in requirements.txt I have bardapi==0.1.29

import streamlit as st
from dotenv.main import load_dotenv
import os
load_dotenv()
st.title("BardAPI for Python")

_BARD_API_KEY=os.environ['_BARD_API_KEY']
#import os
from bardapi import Bard

with st.container () :

    with st.spinner ( 'Wait till Bard gets the answers...' ) :
        input_text = "What is the largest state in the USA?"

        try :
            bard = Bard ( token = _BARD_API_KEY, timeout = 20 )
            response = (bard.get_answer ( input_text ) [ 'content' ])
            st.write ( response )
        except :
            st.error ( 'Please check if you have set the Cookie ' )

on the local machine, I get:

BardAPI for Python

The largest state in the USA is Alaska. It has a total area of 586,412 square miles, which is more than two and a half times the size of Texas, the second largest state. Alaska is also the least densely populated state in the USA, with a population of only about 733,000 people. Here is a list of the 10 largest states in the USA, ranked by total area: Alaska (586,412 square miles) Texas (268,596 square miles) California (163,695 square miles) Montana (147,046 square miles) New Mexico (121,590 square miles) Arizona (113,990 square miles) Nevada (110,572 square miles) Colorado (104,094 square miles) Oregon (98,379 square miles) Wyoming (97,813 square miles) I hope this helps! Let me know if you have any other questions.

on Streamlit Hub I get:

BardAPI for Python Response Error: b’)]}‘\n\n38\n[[“wrb.fr”,null,null,null,null,[9]]]\n56\n[[“di”,163],[“af.httprm”,163,“7269046257447756350”,0]]\n25\n[[“e”,4,null,null,131]]\n’. Unable to get response. Please double-check the cookie values and verify your network environment or google account.

I am using the same cookie; nothing changed. Any help is appreciated. Thank you

hi, have you managed to resolve the problem?

abalgir commented 1 year ago

No , I could not find a solution. Even after following the suggestions: logging out, clearing all cookies, logging in again, using the new value. It does not work.

dsdanielpark commented 1 year ago

No , I could not find a solution. Even after following the suggestions: logging out, clearing all cookies, logging in again, using the new value. It does not work.

This issue is also related to Google, where for reasons like region, account lock, public IP blocking, or response limits, responses are not being received.

The role of the Bard API package is to send requests and receive responses, which was worked perfectly in this issue.

Therefore, there's nothing we can do to resolve it. If this is not a temporary issue, it would be difficult to use.

wajihmsedi commented 1 year ago

I keep getting the same error even by changing account IP etc. Does it help to join the makersuite ?

Waterkin commented 1 year ago

Reopen the chrome solves the problem.

Gaoc3 commented 1 year ago

I have the same problem, when I want to extract the code and convert it to a link py replite , it tells me:

{'content': 'Response Error: b\')]}\\\'\\n\\n39\\n[["wrb.fr",null,null,null,null,[13]]]\\n54\\n[["di",82],["af.httprm",82,"6645275065783071985",2]]\\n25\\n[["e",4,null,null,130]]\\n\'. \nUnable to get response.\nPlease double-check the cookie values and verify your network environment or google account.'} python version : 3.9 BardApi lib version : 0.1.38 bard_answer it's works , but dealing with images and code does not work

dsdanielpark commented 7 months ago

[NOTICE] Please, go to Gemini-API https://github.com/dsdanielpark/Gemini-API

PyPI

Gemini Icon 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