dsdanielpark / Bard-API

The unofficial python package that returns response of Google Bard through cookie value.

Home Page:https://pypi.org/project/bardapi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Receiving 404 error

neopsyon opened this issue · comments

I tried to test the package both on macOS and Windows, but I am receiving 404, used the instructions from the help page, and read the FAQ.
I tried simple code, I made sure to copy the proper cookie value, I tried using cookies both from brave and chrome browsers.

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

Bard().get_answer("나와 내 동년배들이 좋아하는 뉴진스에 대해서 알려줘")['content']

python3 ./bard.py
Traceback (most recent call last):
File "/Users/neopsyon/Desktop/./bard.py", line 5, in
Bard().get_answer("나와 내 동년배들이 좋아하는 뉴진스에 대해서 알려줘")['content']
^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bardapi/core.py", line 78, in init
self.SNlM0e = self._get_snim0e()
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bardapi/core.py", line 149, in _get_snim0e
raise Exception(
Exception: Response status code is not 200. Response Status is 404

I have confirmed that it works correctly on Mac OS now. I cannot reproduce the mentioned error, and I appreciate if you could double-check the details once again.

  • OS: Mac Ventura 13.4.1
  • Python: 3.9.6
  • Bard API: 0.1.38
스크린샷 2024-01-08 오후 7 46 08

Bard API package works correctly on Mac, Linux (including Google Colab), and Windows. However, if you repeatedly reconnect sessions, the cookies may get refreshed. Please avoid creating the object multiple times.

When cookies are refreshed, you should:

  1. Log out.
  2. Completely close your browser and restart it.
  3. Log in again to input the new cookie values. Depending on your location, you may need three or more cookies, and you can use a Multi-cookie bard object if necessary.

For more details, refer to the readme, FAQ, and existing issues.

If you can reproduce the error mentioned above, please provide detailed information and create an issue. It's recommended to test this on Google Colab if possible.

Thank you. The error seems to be non-reproducible, and it's not a package code issue, as I verified it directly on Mac OS.

Usually, a 404 error occurs in situations where the server was found, but it couldn't retrieve the requested page. Here are 5 ways to resolve 404 errors:

  • Restart your browser.
  • Clear cache and browsing data.
  • Double-check for any mistyped characters in the URL.
  • Try accessing the website from another device.
  • Use the Incognito window or private browsing mode.