mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2024-12-23 11:22:42 -06: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]:
|
||||
from sys import platform
|
||||
|
||||
# if use_gsa:
|
||||
if platform == "darwin":
|
||||
use_gsa = False
|
||||
# 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)")
|
||||
g = gsa.authenticate(username, password, gsa.Anisette())
|
||||
pet = g["t"]["com.apple.gs.idms.pet"]["token"]
|
||||
|
|
Loading…
Reference in a new issue