diff options
author | Aymane Hrouch <jo.aymane@gmail.com> | 2023-04-27 16:43:59 +0200 |
---|---|---|
committer | Aymane Hrouch <jo.aymane@gmail.com> | 2023-04-27 16:43:59 +0200 |
commit | f1594cfddecf2bd47a25d54852834b392eaa4efd (patch) | |
tree | 6fec52831117ee43fe7141a153b7e123ff09d469 /unfinished/bard | |
parent | Merge pull request #201 from DanielShemesh/patch-4 (diff) | |
download | gpt4free-f1594cfddecf2bd47a25d54852834b392eaa4efd.tar gpt4free-f1594cfddecf2bd47a25d54852834b392eaa4efd.tar.gz gpt4free-f1594cfddecf2bd47a25d54852834b392eaa4efd.tar.bz2 gpt4free-f1594cfddecf2bd47a25d54852834b392eaa4efd.tar.lz gpt4free-f1594cfddecf2bd47a25d54852834b392eaa4efd.tar.xz gpt4free-f1594cfddecf2bd47a25d54852834b392eaa4efd.tar.zst gpt4free-f1594cfddecf2bd47a25d54852834b392eaa4efd.zip |
Diffstat (limited to 'unfinished/bard')
-rw-r--r-- | unfinished/bard/__init__.py | 31 | ||||
-rw-r--r-- | unfinished/bard/typings.py | 2 |
2 files changed, 17 insertions, 16 deletions
diff --git a/unfinished/bard/__init__.py b/unfinished/bard/__init__.py index ef8980d7..f1d68b92 100644 --- a/unfinished/bard/__init__.py +++ b/unfinished/bard/__init__.py @@ -1,12 +1,12 @@ -from requests import Session -from re import search -from random import randint from json import dumps, loads -from urllib.parse import urlencode -from dotenv import load_dotenv from os import getenv +from random import randint +from re import search +from urllib.parse import urlencode from bard.typings import BardResponse +from dotenv import load_dotenv +from requests import Session load_dotenv() token = getenv('1psid') @@ -62,16 +62,17 @@ class Completion: 'rt': 'c', }) - response = client.post(f'https://bard.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate?{params}', - data={ - 'at': snlm0e, - 'f.req': dumps([None, dumps([ - [prompt], - None, - [conversation_id, response_id, choice_id], - ])]) - } - ) + response = client.post( + f'https://bard.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate?{params}', + data={ + 'at': snlm0e, + 'f.req': dumps([None, dumps([ + [prompt], + None, + [conversation_id, response_id, choice_id], + ])]) + } + ) chat_data = loads(response.content.splitlines()[3])[0][2] if not chat_data: diff --git a/unfinished/bard/typings.py b/unfinished/bard/typings.py index ddf803b6..75b73bf9 100644 --- a/unfinished/bard/typings.py +++ b/unfinished/bard/typings.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Optional, Union +from typing import Dict, List, Union class BardResponse: |