forked from picklepete/pyicloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of trying to look for a specific cookie to save, discarding all others, and persisting the cookies manually using pickle, we build on the functionality of cookielib, which already has functionality to save and load cookiejars. The request library is documented to work with any subclass of cookielib.CookieJar. This ensures that we only save persistent cookies (which includes the X-APPLE-WEB-KB cookie), and skip session cookies, which should make the code more future proof in case Apple adds more persistent cookies. This also fixes picklepete#44, which was still occurring because we were persisting the cookies of the request, not the session, and when logging in with a persisted cookie the resulting request did not have the X-APPLE-WEB-KB set, so we ended up overwriting the cookie file with one that didn't contain any X-APPLE-WEB-KB cookie anymore.
- Loading branch information
Showing
1 changed file
with
15 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters