Commit graph

258 commits

Author SHA1 Message Date
Tor Arne Vestbø
f9a9818d03 Merge pull request #121 from chadj/issue_90_fix
Additional clientContext data for iphone play sound call.

Fixes picklepete/pyicloud#90
2017-02-11 15:54:49 +01:00
Chad Johnson
200e00b37c Additional clientContext data for iphone play sound call - picklepete/pyicloud#90 2017-02-10 16:51:36 -06:00
Tor Arne Vestbø
ced8e83a40 Detect 'errorReason' in error messages from iCloud API 2017-01-09 19:39:40 +01:00
Tor Arne Vestbø
7d57f06bb1 Change PhotosAlbum._parse_binary_feed() to freestanding function
It doesn't really depend on self, and will be used from
outside PhotoAlbum.
2016-10-09 23:48:48 +02:00
Tor Arne Vestbø
2d541a9681 photos: Implement more generic folder fetching
Preparation for photo service update/refresh functionality.
2016-10-09 23:46:10 +02:00
Tor Arne Vestbø
1e53077ab9 Add basic logging to PhotosService 2016-10-09 23:40:11 +02:00
Tor Arne Vestbø
3b57397795 Add title and description properties to PhotoAsset 2016-10-09 23:39:16 +02:00
Tor Arne Vestbø
801ee8f7f7 Fix Python 3 issues in Photos service 2016-10-09 23:38:03 +02:00
Tor Arne Vestbø
254e6a7b44 Merge pull request #95 from felciano/patch-1
Add missing import in 2FA documentation
2016-10-09 22:35:36 +02:00
Ramon Felciano
b231a5ce2b Fixed missing import
For 2FA code to wrk it needs access to the `click` library
2016-08-13 11:37:32 -07:00
Tor Arne Vestbø
5924fadd85 Add Python 3.5 to Travis CI testing 2016-07-11 22:50:07 +02:00
Adam Coddington
3818c43eff Release 0.9.1; fixes six version requirement. 2016-06-30 10:08:45 -07:00
Adam Coddington
5b0ca04751 Pinning six for @python_2_unicode_compatible. 2016-06-30 10:07:50 -07:00
Adam Coddington
b6297781fa Release 0.9; Add support for Account Service; fixes for Python 3.x. 2016-06-20 20:42:00 -07:00
Adam Coddington
1c80389305 Merge pull request #82 from satetsu888/master
fix reminder post function for python3
2016-06-20 20:40:36 -07:00
Adam Coddington
2d4ca14710 [#83] Adding support for icloud Account Service. Thanks @serii833! 2016-06-20 20:38:30 -07:00
Adam Coddington
2b004a2a55 Minor alterations to AccountService. 2016-06-20 20:35:46 -07:00
Adam Coddington
9a9200d43d Update README.rst
Changing variable name corresponding to `PyiCloudService` instance to `api` to match nearby docs.
2016-05-17 17:58:27 -07:00
serii
adb14d1468 Add ICloud Account service 2016-05-17 23:21:28 +03:00
shotaro.akiyama
e8d8f95afd Fix Reminder post function 2016-05-04 11:00:25 +09:00
Tor Arne Vestbø
14518d4bc8 Merge pull request #81 from Longhanks/master
Remove stray git merge conflict marker
2016-04-11 18:41:28 +02:00
aschulz
79d178adad README fix 2016-04-11 17:42:28 +02:00
Tor Arne Vestbø
e3bf826fce Release 0.8.3
Tor Arne Vestbø <torarnv@gmail.com> (3):
      Detect TTY when deciding whether to enable interactive mode or not
      Handle content-type header with parameters when debugging requests
      Gracefully handle malformed cookiejars
2016-04-11 16:41:59 +02:00
Tor Arne Vestbø
358d84e334 Gracefully handle malformed cookiejars
LoadError would only be raised if the cookiejar didn't contain the
expected magic header. But a pickeled jar would potentially contain
data that raised a UnicodeDecodeError, so we need account for both.
2016-04-11 16:37:34 +02:00
Tor Arne Vestbø
721f2a0d69 Handle content-type header with parameters when debugging requests 2016-04-02 22:05:10 +02:00
Tor Arne Vestbø
1c1b9ef927 Detect TTY when deciding whether to enable interactive mode or not 2016-04-02 17:09:13 +02:00
Tor Arne Vestbø
c372797407 Release 0.8.2
Bart274 <de_van_bos@msn.com> (1):
      Use Python 3 exception handling syntax (PEP 3110)

Tor Arne Vestbø <torarnv@gmail.com> (1):
      Add MIT license
2016-04-02 13:30:56 +02:00
Tor Arne Vestbø
e59eafe04d Add MIT license
As discussed in #78
2016-04-02 13:25:48 +02:00
Bart274
85598c9a6b Use Python 3 exception handling syntax (PEP 3110) 2016-03-13 15:07:25 +01:00
Tor Arne Vestbø
49eebc5cdc Release 0.8.1
Bart274 <de_van_bos@msn.com> (1):
      Replace manual time zone handling with use of the tzlocal module

Tor Arne Vestbø <torarnv@gmail.com> (5):
      Remove leftover debug logging from iCloud Photo service
      Remove useless sanity check for sparse photo album assets
      Don't assume request response is always JSON
      Charge HTTP logging to separate child logger of each service
      Don't set host header in reminders service
2016-03-12 14:57:26 +01:00
Bart274
a6aa998a04 Replace manual time zone handling with use of the tzlocal module
This solves an issue where we would end up with an empty list of
time zones, throwing an exception as a result.

It also resolves to the user's actual Olson time zone name,
instead of the first of all the possible time zone names that
match the current time zone of the user.

The two helper methods are no longer needed, as we can now use
get_localzone() directly.
2016-03-12 14:48:23 +01:00
Tor Arne Vestbø
8e45bf98db Don't set host header in reminders service
It's automatically taken care of by the requests module based on
the URL, and explicitly setting it on the globally shared session
object results in other services (such as the calendar service)
breaking when used after the reminders service in the same session.
2016-03-12 14:48:23 +01:00
Tor Arne Vestbø
b2f0cb992c Charge HTTP logging to separate child logger of each service
Unfortunately log filters only apply to each logger, not to its
children, so we have to make sure the http child loggers has the
same password filter as the root base filter.
2016-03-12 12:38:25 +01:00
Tor Arne Vestbø
c96a3bdc9f Don't assume request response is always JSON
If the response's content-type is not one of the two json mimetypes
iCloud will send us we need to return early, not try to parse the
error messsage out of an invalid json object.

For added safety we wrap the JSON decoding in a try/except, so that
malformed JSON data will not result in an exception from that part
of the code (though it will likely still raise at a later point when
the JSON data is parsed in service logic).

Fixes #71
2016-03-12 12:38:11 +01:00
Tor Arne Vestbø
8dc3f524ad Remove useless sanity check for sparse photo album assets
The length of a hash will always equal the length of its values.
2016-03-12 12:36:43 +01:00
Tor Arne Vestbø
9817d6b08a Remove leftover debug logging from iCloud Photo service 2016-03-12 12:36:43 +01:00
Tor Arne Vestbø
0c138d6dac Release 0.8.0
Adam Coddington <me@adamcoddington.net> (2):
      Drops support for Python 2.6.
      [#64] Adds Keychain-based Authentication

Daren Lord <dlaccount@icloud.com> (1):
      Squashed commit of the following:

Tor Arne Vestbø <torarnv@gmail.com> (11):
      Normalize HTTP header names to title case
      Remove three unused endpoint definitions from PyiCloudService base
      Use same setup/login endpoint as iCloud webapp
      Don't set Host header manually
      Fix reStructuredText inline literal formatting in README
      Document how to use the contacts API
      Simplify login sequence
      Add centralized logging of iCloud API requests
      Add support for two-factor authentication
      Add iCloud Photo Library service
      Tweak wording of password prompt

yannickulrich <yannick.ulrich@collinproject.de> (3):
      Adding Reminder support
      PEP8 compatibility
      PEP8 for base.py
2016-03-01 01:32:32 +01:00
Tor Arne Vestbø
fa7ffa32f0 Tweak wording of password prompt
iCloud is branded with a lower case 'i' like most other Apple products.
2016-02-25 13:40:37 +01:00
Tor Arne Vestbø
d4e2bac926 Merge pull request #59 from torarnv/add-photos-service
Add photos service
2016-02-25 13:34:37 +01:00
Tor Arne Vestbø
58cbc51701 Add iCloud Photo Library service
Fixes issue #46.
2016-02-25 13:33:43 +01:00
Tor Arne Vestbø
ab889e7232 Merge pull request #68 from torarnv/add-support-for-2fa
Add support for two-factor authentication (2FA)
2016-02-25 13:33:27 +01:00
Tor Arne Vestbø
7ec72a1625 Add support for two-factor authentication
When 2FA is enabled in iCloud most iCloud services are unavailable
without first going through the 2FA handshake. We now have API to
initiate the 2FA, which can be used by more advanced API clients.

The built in command line 'icloud' application has not been updated,
as listing and managing devices though Find my iPhone is one of the
services that do not require 2FA.

Fixes issue #66.
2016-02-25 13:33:05 +01:00
Tor Arne Vestbø
c3da6220ef Merge pull request #69 from torarnv/add-centralized-api-request-logging
Add centralized logging of iCloud API requests
2016-02-25 13:31:17 +01:00
Tor Arne Vestbø
acd4a2f7a4 Add centralized logging of iCloud API requests
Allows easier debugging of failing API calls. We filter out iCloud
password so that debug logs can be attached to bug reports, etc.

Errors are raised as PyiCloudAPIResponseError with a reason and
code property, in addition to being logged, which allows them to
be handled by client code, or will at least give a clearer idea
about the issue than e.g. opaque key errors when trying to access
non existent properties of the JSON response.
2016-02-25 13:26:11 +01:00
Adam Coddington
2f0dcd1ac2 [#64] Adds Keychain-based Authentication
Squashed commit of the following:

commit 0eb23aa87c264152716933e03827f040742e6d70
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Feb 20 14:21:48 2016 -0800

    Updating readme to reflect updated flow.

commit 840268e2db6093b5cb573c6a3e71204bf5b08b48
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Feb 20 14:18:39 2016 -0800

    Dropping python 2.6 support workaround.

commit 9dcbd460482c2925bda490be2be884a2a2526062
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Feb 20 14:18:00 2016 -0800

    Adding additional behavior at @torarnv's request.

commit 6c711bb12beea7c792b5d386203373423b6e56e2
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 23 15:08:29 2016 -0800

    Workaround for obsolete versions of Python 2.

commit b0765b7b6bf9974348061043da9a110c6bd7d985
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 23 14:56:53 2016 -0800

    Style changes to avoid line length overage.

commit 4decc576432ef23edae01b9621f2689b4f3c6c84
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 23 14:01:27 2016 -0800

    Adding documentation; also adding --delete-from-keyring command-line option.

commit a6b0224e93a8bc9159cf06ba5792a384f7fbb060
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 23 13:44:09 2016 -0800

    Adding functionality allowing authentication using iCloud passwords stored in the system keychain.

    Adds the following new command-line options:

    * `--password-interactive`: Allows you to specify your password
      interactively rather than typing it into the command-line.
    * `--store-in-keychain`: Allows you to store the password in use in the
      system keychain.

    If no password is specified when instantiating `PyiCloudService` or when
    using the command-line utility (via either `--password-interactive` or
    `--password`), the system keychain will be queried for a stored
    password, and an exception will be raised if one was not found.

commit 4ba03fb02d51673dfb7183dde49ab4c0bec4afb3
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 23 13:43:39 2016 -0800

    Removing unused imports.
2016-02-23 17:44:03 -08:00
Adam Coddington
77978b391f Drops support for Python 2.6.
Squashed commit of the following:

commit 2f3bc6d4829c0f6f901ed2185a2e05f31d1be79f
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 23 14:58:44 2016 -0800

    Most modern tools have dropped support for Python 2.6 at this point; we should, too.
2016-01-29 18:26:02 -08:00
Adam Coddington
13f71ddbcc Merge branch 'simplify-login-sequence' 2016-01-22 22:23:19 -08:00
Tor Arne Vestbø
fce7966974 Simplify login sequence
There's no need to validate before authenticating, as we don't log
in with extended_login=True, which means there are no persisted
login cookies besides the one ensuring we only get a single e-mail.

The id that refresh_validate used to generate is also not needed,
as authentication with just the username and password works fine,
and is what the icloud.com webapp also does.

Finally, we can skip the second validate after authentication as
the dsInfo/dsid is available through the response we get from the
authentication.
2016-01-19 16:44:52 +01:00
Daren Lord
3b3857d295 Squashed commit of the following:
commit 211d54bb3f0e9fa942e31aa7d48b6cfbb22e126f
Author: Daren Lord <dlaccount@icloud.com>
Date:   Mon Jan 18 21:05:51 2016 -0700

    Fixed pep8 errors

commit 0a8ba6855405b39003f1aeef3b35fa4ef6a27e9e
Author: Daren Lord <dlaccount@icloud.com>
Date:   Mon Jan 18 21:02:02 2016 -0700

    Adding in six.

commit 1abff8f5cf5710d898a963b90be269b0127b1c96
Author: Daren Lord <dlaccount@icloud.com>
Date:   Mon Jan 18 20:57:31 2016 -0700

    Adding in python 3 support for cookielib
2016-01-19 07:22:29 -08:00
Adam Coddington
c0a597986e Merge pull request #57 from torarnv/various-cleanup-fixes
Various cleanup fixes
2016-01-19 07:11:05 -08:00