From 3dd1b0b3d8e995c5f438b13186e5cca408c9699c Mon Sep 17 00:00:00 2001 From: CRIMINAL Date: Thu, 22 Apr 2021 19:16:24 +0100 Subject: [PATCH] Handle 404'ed auths. OnlyFans have begun rate limiting :( I'll probably implement a "bypass" soon. --- apis/onlyfans/onlyfans.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/apis/onlyfans/onlyfans.py b/apis/onlyfans/onlyfans.py index bcfaf0d4e..4750490ae 100644 --- a/apis/onlyfans/onlyfans.py +++ b/apis/onlyfans/onlyfans.py @@ -597,17 +597,20 @@ def resolve_auth(auth: create_auth): auth.errors.remove(error) break resolve_auth(self.auth) - if self.auth.errors: - error = self.auth.errors[-1] - error_message = error.message - if "token" in error_message: - break - if "Code wrong" in error_message: - break + if not self.auth.active: + if self.auth.errors: + error = self.auth.errors[-1] + error_message = error.message + if "token" in error_message: + break + if "Code wrong" in error_message: + break + else: + print("Auth 404'ed") continue else: print(f"Welcome {self.auth.name} | {self.auth.username}") - return self.auth + break def get_authed(self) -> Union[create_auth]: if not self.auth.active: @@ -622,6 +625,7 @@ def get_authed(self) -> Union[create_auth]: me_api.session_manager = self.session_manager self.auth = me_api else: + # 404'ed self.auth.active = False return self.auth