{ "info": { "author": "Peter Evans and Adam Coddington", "author_email": "me@adamcoddington.net", "bugtrack_url": null, "classifiers": [], "description": "## pyicloud\n\nPyiCloud is a module which allows pythonistas to interact with iCloud webservices. It's powered by the fantastic [requests](https://github.com/kennethreitz/requests) HTTP library.\n\nAt its core, PyiCloud connects to iCloud using your username and password, then performs calendar and iPhone queries against their API.\n\n### Authentication\n\nAuthentication is as simple as passing your username and password to the `PyiCloudService` class:\n\n```python\n>>> from pyicloud import PyiCloudService\n>>> api = PyiCloudService('jappleseed@apple.com', 'password')\n```\n\nIn the event that the username/password combination is invalid, a `PyiCloudFailedLoginException` exception is thrown.\n\n### Devices\n\nYou can list which devices associated with your account by using the `devices` property:\n\n```python\n>>> api.devices\n{\nu'i9vbKRGIcLYqJnXMd1b257kUWnoyEBcEh6yM+IfmiMLh7BmOpALS+w==': ,\nu'reGYDh9XwqNWTGIhNBuEwP1ds0F/Lg5t/fxNbI4V939hhXawByErk+HYVNSUzmWV': \n}\n```\n\nand you can access individual devices by either their index, or their ID:\n\n```python\n>>> api.devices[0]\n\n>>> api.devices['i9vbKRGIcLYqJnXMd1b257kUWnoyEBcEh6yM+IfmiMLh7BmOpALS+w==']\n\n```\n\nor, as a shorthand if you have only one associated apple device, you can simply use the `iphone` property to access the first device associated with your account:\n\n```python\n>>> api.iphone\n\n```\n\nNote: the first device associated with your account may not necessarily be your iPhone.\n\n### Find My iPhone\n\nOnce you have successfully authenticated, you can start querying your data!\n\n#### Location\n\nReturns the device's last known location. The Find My iPhone app must have been installed and initialized.\n\n```python\n>>> api.iphone.location()\n{u'timeStamp': 1357753796553, u'locationFinished': True, u'longitude': -0.14189, u'positionType': u'GPS', u'locationType': None, u'latitude': 51.501364, u'isOld': False, u'horizontalAccuracy': 5.0}\n```\n\n#### Status\n\nThe Find My iPhone response is quite bloated, so for simplicity's sake this method will return a subset of the properties.\n\n```python\n>>> api.iphone.status()\n{'deviceDisplayName': u'iPhone 5', 'deviceStatus': u'200', 'batteryLevel': 0.6166913, 'name': u\"Peter's iPhone\"}\n```\n\nIf you wish to request further properties, you may do so by passing in a list of property names.\n\n#### Play Sound\n\nSends a request to the device to play a sound, if you wish pass a custom message you can do so by changing the subject arg.\n\n```python\n>>> api.iphone.play_sound()\n```\n\nA few moments later, the device will play a ringtone, display the default notification (\"Find My iPhone Alert\") and a confirmation email will be sent to you.\n\n#### Lost Mode\n\nLost mode is slightly different to the \"Play Sound\" functionality in that it allows the person who picks up the phone to call a specific phone number *without having to enter the passcode*. Just like \"Play Sound\" you may pass a custom message which the device will display, if it's not overriden the custom message of \"This iPhone has been lost. Please call me.\" is used.\n\n```python\n>>> phone_number = '555-373-383'\n>>> message = 'Thief! Return my phone immediately.'\n>>> api.iphone.lost_device(phone_number, message)\n```\n\n### Calendar\n\nThe calendar webservice currently only supports fetching events.\n\n#### Events\n\nReturns this month's events:\n\n```python\napi.calendar.events()\n```\n\nOr, between a specific date range:\n\n```python\nfrom_dt = datetime(2012, 1, 1)\nto_dt = datetime(2012, 1, 31)\napi.calendar.events(from_dt, to_dt)\n```\n\n### File Storage (Ubiquity)\n\nYou can access documents stored in your iCloud account by using the `files` property's `dir` method:\n\n```python\n>>> api.files.dir()\n[u'.do-not-delete',\n u'.localized',\n u'com~apple~Notes',\n u'com~apple~Preview',\n u'com~apple~mail',\n u'com~apple~shoebox',\n u'com~apple~system~spotlight'\n]\n```\n\nYou can access children and their children's children using the filename as an index:\n\n```python\n>>> api.files['com~apple~Notes']\n\n>>> api.files['com~apple~Notes'].type\nu'folder'\n>>> api.files['com~apple~Notes'].dir()\n[u'Documents']\n>>> api.files['com~apple~Notes']['Documents'].dir()\n[u'Some Document']\n>>> api.files['com~apple~Notes']['Documents']['Some Document'].name\nu'Some Document'\n>>> api.files['com~apple~Notes']['Documents']['Some Document'].modified\ndatetime.datetime(2012, 9, 13, 2, 26, 17)\n>>> api.files['com~apple~Notes']['Documents']['Some Document'].size\n1308134\n>>> api.files['com~apple~Notes']['Documents']['Some Document'].type\nu'file'\n```\n\nAnd when you have a file that you'd like to download, the `open` method will return a response object from which you can read the `content`.\n\n```python\n>>> api.files['com~apple~Notes']['Documents']['Some Document'].open().content\n'Hello, these are the file contents'\n```\n\nNote: the object returned from the above `open` method is a [response object](http://www.python-requests.org/en/latest/api/#classes) and the `open` method can accept any parameters you might normally use in a request using [requests](https://github.com/kennethreitz/requests).\n\nFor example, if you know that the file you're opening has JSON content:\n\n```python\n>>> api.files['com~apple~Notes']['Documents']['information.json'].open().json()\n{'How much we love you': 'lots'}\n>>> api.files['com~apple~Notes']['Documents']['information.json'].open().json()['How much we love you']\n'lots'\n```\n\nOr, if you're downloading a particularly large file, you may want to use the `stream` keyword argument, and read directly from the raw response object:\n\n```python\n>>> download = api.files['com~apple~Notes']['Documents']['big_file.zip'].open(stream=True)\n>>> with open('downloaded_file.zip', 'wb') as opened_file:\n opened_file.write(download.raw.read())\n```\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/latestrevision/pyicloud", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pyicloud_dwoh", "package_url": "https://pypi.org/project/pyicloud_dwoh/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyicloud_dwoh/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/latestrevision/pyicloud" }, "release_url": "https://pypi.org/project/pyicloud_dwoh/0.4.1/", "requires_dist": null, "requires_python": null, "summary": "PyiCloud is a module which allows pythonistas to interact with iCloud webservices. This is an unofficial fork of the official package 'pyicloud'.", "version": "0.4.1" }, "last_serial": 886320, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "74d1eab521e2b447c1a90e1ff486da5d", "sha256": "7ea27424bca8d3042ac19fe99108165db56d715357dce4431e018885d22d52f5" }, "downloads": -1, "filename": "pyicloud_dwoh-0.3.tar.gz", "has_sig": false, "md5_digest": "74d1eab521e2b447c1a90e1ff486da5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7126, "upload_time": "2013-09-06T02:17:58", "url": "https://files.pythonhosted.org/packages/98/d1/5c251a95271f5d0b648a181f632c614484f247edfa33952d4245f5711ec6/pyicloud_dwoh-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "6ade5c11e41ec279994f6837d8ab1589", "sha256": "b5d432d532482b9451450d6ff999503a6f1446306614d7f80ae09884da919def" }, "downloads": -1, "filename": "pyicloud_dwoh-0.4.tar.gz", "has_sig": false, "md5_digest": "6ade5c11e41ec279994f6837d8ab1589", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7452, "upload_time": "2013-09-06T02:24:37", "url": "https://files.pythonhosted.org/packages/55/fa/eeead68c25e87a5c069aa26d00f49059e37d18e678406a13ff6764f5ca8d/pyicloud_dwoh-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "2e44a076935c17602a71db3fd48eb928", "sha256": "26f75013833aa3dab993f7dbfbe3a119544c98711fc8583a1970c3d6cbee19e0" }, "downloads": -1, "filename": "pyicloud_dwoh-0.4.1.tar.gz", "has_sig": false, "md5_digest": "2e44a076935c17602a71db3fd48eb928", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7434, "upload_time": "2013-10-10T15:57:37", "url": "https://files.pythonhosted.org/packages/66/99/530b25f1c4b6f4f62935c2a3a49547fb676ff2e9501f7be2b0ab21ea950d/pyicloud_dwoh-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2e44a076935c17602a71db3fd48eb928", "sha256": "26f75013833aa3dab993f7dbfbe3a119544c98711fc8583a1970c3d6cbee19e0" }, "downloads": -1, "filename": "pyicloud_dwoh-0.4.1.tar.gz", "has_sig": false, "md5_digest": "2e44a076935c17602a71db3fd48eb928", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7434, "upload_time": "2013-10-10T15:57:37", "url": "https://files.pythonhosted.org/packages/66/99/530b25f1c4b6f4f62935c2a3a49547fb676ff2e9501f7be2b0ab21ea950d/pyicloud_dwoh-0.4.1.tar.gz" } ] }