mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2025-01-09 17:33:47 +00:00
check for pyobjc before using it
This commit is contained in:
parent
baf922af61
commit
ba1537ed58
1 changed files with 10 additions and 2 deletions
|
@ -50,8 +50,16 @@ def get_auth_token(
|
||||||
) -> tuple[str, str]:
|
) -> tuple[str, str]:
|
||||||
from sys import platform
|
from sys import platform
|
||||||
|
|
||||||
# if use_gsa:
|
use_gsa = False
|
||||||
if platform == "darwin":
|
# Check if objc is importable
|
||||||
|
try:
|
||||||
|
if platform == "darwin":
|
||||||
|
import objc
|
||||||
|
use_gsa = True
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if use_gsa:
|
||||||
logger.debug("Using GrandSlam to authenticate (native Anisette)")
|
logger.debug("Using GrandSlam to authenticate (native Anisette)")
|
||||||
g = gsa.authenticate(username, password, gsa.Anisette())
|
g = gsa.authenticate(username, password, gsa.Anisette())
|
||||||
pet = g["t"]["com.apple.gs.idms.pet"]["token"]
|
pet = g["t"]["com.apple.gs.idms.pet"]["token"]
|
||||||
|
|
Loading…
Reference in a new issue