Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio committed May 15, 2023
1 parent 54617da commit 1ae1440
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ class Chatbot()
```

A class to interact with Google Bard.

Parameters:

Parameters
session_id: str
The __Secure-1PSID cookie.
proxy: str

<a id="Bard.Chatbot.ask"></a>

Expand All @@ -36,3 +35,4 @@ Send a message to Google Bard and return the response.
**Returns**:

A dict containing the response from Google Bard.

1 change: 1 addition & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from os import environ

from Bard import Chatbot

token = environ.get("BARD_TOKEN")
Expand Down
9 changes: 5 additions & 4 deletions src/Bard.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"""
import argparse
import json
import os
import random
import re
import string
import os
import sys

import requests
Expand Down Expand Up @@ -54,6 +54,7 @@ class Chatbot:
Parameters
session_id: str
The __Secure-1PSID cookie.
proxy: str
"""

__slots__ = [
Expand All @@ -66,7 +67,7 @@ class Chatbot:
"session",
]

def __init__(self, session_id: str, proxy: str=None):
def __init__(self, session_id: str, proxy: str = None):
headers = {
"Host": "bard.google.com",
"X-Same-Domain": "1",
Expand All @@ -84,8 +85,8 @@ def __init__(self, session_id: str, proxy: str=None):
self.session.proxies.update(
{
"http": proxy,
"https": proxy
}
"https": proxy,
},
)
self.session.headers = headers
self.session.cookies.set("__Secure-1PSID", session_id)
Expand Down

0 comments on commit 1ae1440

Please sign in to comment.