Reverse Engineered Async API for Google Bard
Project description
Bard-WebAPI
Reverse Engineered Async API for Google Bard
Installation
pip install bard-webapi
Authentication
- Go to https://bard.google.com/ and login with your Google account
- Press F12 for web inspector, go to
Network
tab and refresh the page - Click any request and copy cookie values of
__Secure-1PSID
and__Secure-1PSIDTS
Usage
Initialization
from bard_webapi import BardClient
Secure_1PSID = [COOKIE VALUE HERE]
Secure_1PSIDTS = [COOKIE VALUE HERE]
client = BardClient(Secure_1PSID, Secure_1PSIDTS, proxy=None)
await client.init()
One-time Chat
response = await client.generate("Hello World!")
print(response.text)
Chat with Persistent History
chat = client.newchat()
await client.generate("Briefly introduce Europe", chat=chat)
response = await client.generate("What's the population there?", chat=chat)
print(response.text)
Retrieve Images in Response
response = await client.generate("Show me some pictures of cats")
images = response.images
for image in images:
print(f"{image.alt}({image.url})", "\n")
Check Other Answer Choices
response = await client.generate("What's the best Japanese dish in your mind? Choose one only.")
choices = response.choices
for choice in choices:
print(choice, "\n----------------------------------\n")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bard-webapi-0.1.0.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for bard_webapi-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51d513ce0b8d75790d8ee87c9b40fed4371f5042ffef696bb25cda935c6f7b3a |
|
MD5 | 89fc05f6771901b7a2a486327a0ad73b |
|
BLAKE2b-256 | 289bbdf70959269c105cc44b8485db9e0869116e1aae43a3000bfdc2a414da53 |