Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

'BardAsync' object has no attribute 'SNlM0e' after update to latest version at github #253

Closed
ahmadkeren opened this issue Dec 27, 2023 · 13 comments
Assignees

Comments

@ahmadkeren
Copy link

my code:

bard = BardAsync(token=tokenBard)
jawaban = await bard.get_answer(q)

previously it was running normally before I updated the version

@ahmadkeren
Copy link
Author

i rollback to version 0.1.30. everything working fine

@raymerjacque
Copy link

i rollback to version 0.1.30. everything working fine

confirmed this worked.

@dsdanielpark
Copy link
Owner

dsdanielpark commented Dec 28, 2023

We are currently overhauling bard async on the GitHub dev version. It will be a bit more organized in version 0.1.39.
It can currently be partially checked on the GitHub dev version.
The synchronous version is still somewhat unstable (as it hasn't been properly optimized), so we recommend using the regular bard. Thank you.

@iafuad
Copy link

iafuad commented Dec 30, 2023

We are currently overhauling bard async on the GitHub dev version. It will be a bit more organized in version 0.1.39. It can currently be partially checked on the GitHub dev version. The synchronous version is still somewhat unstable (as it hasn't been properly optimized), so we recommend using the regular bard. Thank you.

By dev version, are you referring to a separate repository? 'cuz I don't see any dev branch in this repository.

@dsdanielpark
Copy link
Owner

dsdanielpark commented Jan 1, 2024

iafuad

Before updating to PyPI, we conveniently refer to the main branch of the GitHub version as the 'dev' version. Please download and install from the GitHub repository. Once debugging is complete, we upload the official version to PyPI. We are preparing version 0.1.39.

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

@dsdanielpark
Copy link
Owner

ahmadkeren

I will check 0.1.30 and 0.1.38

@iafuad
Copy link

iafuad commented Jan 2, 2024

iafuad

Before updating to PyPI, we conveniently refer to the main branch of the GitHub version as the 'dev' version. Please download and install from the GitHub repository. Once debugging is complete, we upload the official version to PyPI. We are preparing version 0.1.39.

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

The original issue is on the GitHub version though. I don't know about the PyPI version but the async class in GitHub version is completely unusable.

@dsdanielpark
Copy link
Owner

iafuad

I agree with your opinion.

@raymerjacque
Copy link

The current PyPI version ( 0.1.38 ) is faulty. the older 0.1.30 is still the only one that works. I just checked this morning.

dsdanielpark added a commit that referenced this issue Jan 18, 2024
@dsdanielpark
Copy link
Owner

This issue has been resolved in bardapi version 0.1.39. Thank you for reporting the issue.

Bard API - version 0.1.39

$ pip install bardapi==0.1.39
$ pip install -q -U bardapi

https://github.com/dsdanielpark/Bard-API/blob/main/documents/README_DEV.md#using-bard-asynchronously

from httpx import AsyncClient
from bardapi import BardAsync
import os

# Uncomment and set your API key as needed
# os.environ['_BARD_API_KEY'] = 'xxxxxxx'
token = 'xxxxxxx'  # Replace with your actual token

SESSION_HEADERS = {
    "Host": "bard.google.com",
    "X-Same-Domain": "1",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
    "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    "Origin": "https://bard.google.com",
    "Referer": "https://bard.google.com/",
}
timeout = 30  # Example timeout
proxies = {}  # Replace with your proxies if needed

client = AsyncClient(
    http2=True,
    headers=SESSION_HEADERS,
    cookies={"__Secure-1PSID": token},
    timeout=timeout,
    proxies=proxies,
)

bard_async = BardAsync(token=token, client=client)

# Asynchronous function to get the answer
async def get_bard_answer(question):
    await bard_async.async_setup()  # Ensure async setup is done
    return await bard_async.get_answer(question)

response = await get_bard_answer("나와 내 동년배들이 좋아하는 뉴진스에 대해서 알려줘")
print(response['content'])

@raymerjacque
Copy link

it works, thank you :)

@dsdanielpark
Copy link
Owner

raymerjacque

Thank you for your support. It has been a great help.

Also, you are welcome to contribute at any time by addressing new issues or refactoring packages.

We always look forward to your participation in the community. Thank you.

@ahmadkeren
Copy link
Author

raymerjacque

Thank you for your support. It has been a great help.

Also, you are welcome to contribute at any time by addressing new issues or refactoring packages.

We always look forward to your participation in the community. Thank you.

thank you sir

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants