refactor: remove unused import of get_cookies_from_browser across multiple example scripts

This commit is contained in:
bohd4nx
2026-05-21 00:21:41 +03:00
parent 516e69f820
commit 92384b96f0
14 changed files with 12 additions and 26 deletions
+11 -1
View File
@@ -7,15 +7,25 @@ from pyfragment.core.constants import FRAGMENT_BASE_URL, FRAGMENT_DOMAIN, REQUIR
from pyfragment.exceptions import CookieError
from pyfragment.models.cookies import CookieResult
try:
import rookiepy as rookiepy # type: ignore[import-not-found,no-redef]
except Exception:
rookiepy = None
def get_cookies_from_browser(browser: str = "chrome") -> CookieResult:
global rookiepy
key = browser.lower()
if key not in SUPPORTED_BROWSERS:
supported = ", ".join(sorted(SUPPORTED_BROWSERS))
raise CookieError(CookieError.UNSUPPORTED_BROWSER.format(browser=browser, supported=supported))
try:
import rookiepy # type: ignore[import-not-found]
if rookiepy is None:
import rookiepy as imported_rookiepy # type: ignore[import-not-found]
rookiepy = imported_rookiepy
jar: list[dict[str, Any]] = getattr(rookiepy, key)([FRAGMENT_DOMAIN])
except Exception as exc:
+1 -1
View File
@@ -74,7 +74,7 @@ class UserNotFoundError(FragmentAPIError):
class AnonymousNumberError(FragmentAPIError):
"""Raised for Fragment anonymous number API failures."""
NOT_OWNED = "Number '{number}' is not linked to your Fragment account, or there are no active sessions to terminate."
NOT_OWNED = "Number '{number}' is not associated with your Fragment account or has no active sessions to terminate."
TERMINATE_FAILED = "Failed to terminate sessions for '{number}': {error}"