You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a python application that will connect to the icloud API and read some stats about my device, log in to be displayed in grafana and take actions, home automation tasks, time to check again next, etc... based on the data I get back. One of the things I'm doing is not updating my position as frequently when I'm farther from home. Sometimes this can mean 16+ hours between location lookups...
This is where the problem is... every single time I connect back to the API, it seems to trigger another login and approval. Does anybody have a code sample/suggestion that I could follow that would help me connect to the API and somehow hold the session for a while, hopefully an extended period of time if I'm only doing one lookup every few hours.
Environment
pyiCloud release with the issue (pip show pyicloud):
Name: pyicloud
Version: 1.0.0
If you authenticate on the cli with icloud --username appleid@domain this will store a session file at /tmp/pyicloud/computerusername/cookies/.session
Any use of the module after the above authentication will look for this session file (if you use the same apple ID in your code)
As long as that session file exists, you shouldn't be prompted for authentication. You can alternatively specify the session path with api = PyiCloudService(apple_id=appleid@domain, cookie_directory=/path/to/cookie/dir to store the cookies and session file at a different path.
The problem
I'm working on a python application that will connect to the icloud API and read some stats about my device, log in to be displayed in grafana and take actions, home automation tasks, time to check again next, etc... based on the data I get back. One of the things I'm doing is not updating my position as frequently when I'm farther from home. Sometimes this can mean 16+ hours between location lookups...
This is where the problem is... every single time I connect back to the API, it seems to trigger another login and approval. Does anybody have a code sample/suggestion that I could follow that would help me connect to the API and somehow hold the session for a while, hopefully an extended period of time if I'm only doing one lookup every few hours.
Environment
pip show pyicloud
):Name: pyicloud
Version: 1.0.0
python -V
):Python 3.11.3
Docker python3 container
The text was updated successfully, but these errors were encountered: