style(services): reorder imports and formatting
This commit is contained in:
+11
-5
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user