summaryrefslogtreecommitdiffstats
path: root/unfinished/bard/__init__.py
diff options
context:
space:
mode:
authorAymane Hrouch <jo.aymane@gmail.com>2023-04-27 16:43:59 +0200
committerAymane Hrouch <jo.aymane@gmail.com>2023-04-27 16:43:59 +0200
commitf1594cfddecf2bd47a25d54852834b392eaa4efd (patch)
tree6fec52831117ee43fe7141a153b7e123ff09d469 /unfinished/bard/__init__.py
parentMerge pull request #201 from DanielShemesh/patch-4 (diff)
downloadgpt4free-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/__init__.py')
-rw-r--r--unfinished/bard/__init__.py31
1 files changed, 16 insertions, 15 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: