Skip to content

Commit 94789b7

Browse files
committed
v0.1.16.8 - fix
1 parent 10e3ee1 commit 94789b7

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

FunPayAPI/account.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,33 +206,17 @@ def update_locale(redirect_url: str):
206206
i = 0
207207
response = None
208208
while i < 10 or response.status_code == 429:
209+
i += 1
209210
response = self.session.request(url=link, data=payload, allow_redirects=False, **kwargs)
210211
if response.status_code == 429:
211212
self.last_429_err_time = time.time()
212213
time.sleep(min(2 ** i, 30))
213214
continue
214-
elif response.status_code == 400 and isinstance(payload, dict) and "csrf_token" in payload:
215-
content_type = response.headers.get("Content-Type")
216-
if content_type and "application/json" in content_type:
217-
d = response.json()
218-
if d.get("error") == 1 and d.get("msg") in ("Оновіть сторінку та повторіть спробу.",
219-
"Обновите страницу и повторите попытку.",
220-
"Please refresh your page and try again."):
221-
while payload["csrf_token"] == self.csrf_token:
222-
try:
223-
self.get()
224-
except:
225-
logger.warning("Произошла ошибка при обновлении данных аккаунта")
226-
logger.debug("TRACEBACK", exc_info=True)
227-
time.sleep(2)
228-
payload["csrf_token"] = self.csrf_token
229-
continue
230-
break
231215
elif not (300 <= response.status_code < 400) or 'Location' not in response.headers:
232216
break
233217
link = response.headers['Location']
234218
update_locale(link)
235-
i += 1
219+
236220
else:
237221
response = self.session.request(url=link, data=payload, allow_redirects=True, **kwargs)
238222

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
......................','.",`............ ..................
5757
............................................................"""
5858

59-
VERSION = "0.1.16.7"
59+
VERSION = "0.1.16.8"
6060

6161
Utils.cardinal_tools.set_console_title(f"FunPay Cardinal v{VERSION}")
6262

0 commit comments

Comments
 (0)