diff --git a/services/roblox.py b/services/roblox.py index d871632..d3da6be 100644 --- a/services/roblox.py +++ b/services/roblox.py @@ -1,8 +1,7 @@ from __future__ import annotations -import asyncio -import logging import random +import asyncio import aiohttp import requests as plain_requests @@ -39,7 +38,9 @@ def _extract_new_cookie(response): return cookie except Exception: pass - sc = response.headers.get("set-cookie", "") or response.headers.get("Set-Cookie", "") + sc = response.headers.get("set-cookie", "") or response.headers.get( + "Set-Cookie", "" + ) if ".ROBLOSECURITY=" in sc: try: return sc.split(".ROBLOSECURITY=")[1].split(";")[0] @@ -132,7 +133,9 @@ def _sync_fresh_cookie(cookie, proxy=None, timeout=15): async def fresh_cookie_async(cookie, proxy=None): loop = asyncio.get_event_loop() - return await loop.run_in_executor(FRESHER_POOL, _sync_fresh_cookie, cookie, proxy, 15) + return await loop.run_in_executor( + FRESHER_POOL, _sync_fresh_cookie, cookie, proxy, 15 + ) async def check_cookie_basic(session, cookie, proxy=None) -> CookieValidationResult: @@ -234,7 +237,10 @@ async def get_year_donate(cookie, user_id, proxy=None) -> int: proxy=f"http://{proxy}" if proxy else None, timeout=aiohttp.ClientTimeout(total=REQUEST_TIMEOUT), ) as response: - if response.status == 200 and response.content_type == "application/json": + if ( + response.status == 200 + and response.content_type == "application/json" + ): data = await response.json() donate = data.get("purchasesTotal", 0) if donate != 0: diff --git a/services/withdrawals.py b/services/withdrawals.py index 54f083f..341ceb1 100644 --- a/services/withdrawals.py +++ b/services/withdrawals.py @@ -79,4 +79,5 @@ async def check_treasury_invoice(invoice_id: int) -> bool: return bool(items and items[0].get("status") == "paid") except Exception as exc: logging.error("check_treasury_invoice: %s", exc) + return False