mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 06:14:29 +00:00
refactor: remove unused import of get_cookies_from_browser across multiple example scripts
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user