From f1594cfddecf2bd47a25d54852834b392eaa4efd Mon Sep 17 00:00:00 2001 From: Aymane Hrouch Date: Thu, 27 Apr 2023 15:43:59 +0100 Subject: Reformat code using PyCharm --- unfinished/bard/__init__.py | 31 ++++++++++++++++--------------- unfinished/bard/typings.py | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'unfinished/bard') 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: -- cgit v1.2.3