style(services): reorder imports and formatting

This commit is contained in:
2026-07-20 09:02:04 +05:00
parent 4adf9aa32e
commit 5e407dc1a8
2 changed files with 12 additions and 5 deletions
+11 -5
View File
@@ -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:
+1
View File
@@ -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