summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaju Komati <komatiraju032@gmail.com>2023-05-01 16:26:33 +0200
committerRaju Komati <komatiraju032@gmail.com>2023-05-01 16:26:33 +0200
commit4b86f5012077e218ae296d81f1305ab0931ec2cc (patch)
tree4061d57addc0ff63815e4d255b499dc7a86cf732
parentMerge pull request #332 from mache102/main (diff)
downloadgpt4free-4b86f5012077e218ae296d81f1305ab0931ec2cc.tar
gpt4free-4b86f5012077e218ae296d81f1305ab0931ec2cc.tar.gz
gpt4free-4b86f5012077e218ae296d81f1305ab0931ec2cc.tar.bz2
gpt4free-4b86f5012077e218ae296d81f1305ab0931ec2cc.tar.lz
gpt4free-4b86f5012077e218ae296d81f1305ab0931ec2cc.tar.xz
gpt4free-4b86f5012077e218ae296d81f1305ab0931ec2cc.tar.zst
gpt4free-4b86f5012077e218ae296d81f1305ab0931ec2cc.zip
-rw-r--r--gpt4free/quora/__init__.py23
-rw-r--r--gpt4free/quora/api.py6
-rw-r--r--gpt4free/quora/graphql/SettingsDeleteAccountButton_deleteAccountMutation_Mutation.graphql1
3 files changed, 19 insertions, 11 deletions
diff --git a/gpt4free/quora/__init__.py b/gpt4free/quora/__init__.py
index afbfb68d..56dd7b24 100644
--- a/gpt4free/quora/__init__.py
+++ b/gpt4free/quora/__init__.py
@@ -285,6 +285,11 @@ class Account:
cookies = open(Path(__file__).resolve().parent / 'cookies.txt', 'r').read().splitlines()
return choice(cookies)
+ @staticmethod
+ def delete_account(token: str, proxy: Optional[str] = None):
+ client = PoeClient(token, proxy=proxy)
+ client.delete_account()
+
class StreamingCompletion:
@staticmethod
@@ -293,11 +298,11 @@ class StreamingCompletion:
custom_model: bool = None,
prompt: str = 'hello world',
token: str = '',
- proxy: Optional[str] = None
+ proxy: Optional[str] = None,
) -> Generator[PoeResponse, None, None]:
_model = MODELS[model] if not custom_model else custom_model
- proxies = { 'http': 'http://' + proxy, 'https': 'http://' + proxy } if proxy else False
+ proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else False
client = PoeClient(token)
client.proxy = proxies
@@ -333,7 +338,7 @@ class Completion:
custom_model: str = None,
prompt: str = 'hello world',
token: str = '',
- proxy: Optional[str] = None
+ proxy: Optional[str] = None,
) -> PoeResponse:
_model = MODELS[model] if not custom_model else custom_model
@@ -454,14 +459,7 @@ class Poe:
response = chunk['text']
return response
- def create_bot(
- self,
- name: str,
- /,
- prompt: str = '',
- base_model: str = 'ChatGPT',
- description: str = '',
- ) -> None:
+ def create_bot(self, name: str, /, prompt: str = '', base_model: str = 'ChatGPT', description: str = '') -> None:
if base_model not in MODELS:
raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')
@@ -475,3 +473,6 @@ class Poe:
def list_bots(self) -> list:
return list(self.client.bot_names.values())
+
+ def delete_account(self) -> None:
+ self.client.delete_account()
diff --git a/gpt4free/quora/api.py b/gpt4free/quora/api.py
index 897215a8..d388baee 100644
--- a/gpt4free/quora/api.py
+++ b/gpt4free/quora/api.py
@@ -541,5 +541,11 @@ class Client:
self.get_bots()
return data
+ def delete_account(self) -> None:
+ response = self.send_query('SettingsDeleteAccountButton_deleteAccountMutation_Mutation', {})
+ data = response['data']['deleteAccount']
+ if 'viewer' not in data:
+ raise RuntimeError(f'Error occurred while deleting the account, Please try again!')
+
load_queries()
diff --git a/gpt4free/quora/graphql/SettingsDeleteAccountButton_deleteAccountMutation_Mutation.graphql b/gpt4free/quora/graphql/SettingsDeleteAccountButton_deleteAccountMutation_Mutation.graphql
new file mode 100644
index 00000000..0af50950
--- /dev/null
+++ b/gpt4free/quora/graphql/SettingsDeleteAccountButton_deleteAccountMutation_Mutation.graphql
@@ -0,0 +1 @@
+mutation SettingsDeleteAccountButton_deleteAccountMutation_Mutation{ deleteAccount { viewer { uid id } }} \ No newline at end of file