Add download badge (#260)

This commit is contained in:
Quentame 2020-03-24 15:21:30 +01:00 committed by GitHub
parent ababe3cdf3
commit 12b345d574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,25 +3,32 @@ pyiCloud
******** ********
.. image:: https://travis-ci.org/picklepete/pyicloud.svg?branch=master .. image:: https://travis-ci.org/picklepete/pyicloud.svg?branch=master
:alt: Check out our test status at https://travis-ci.org/picklepete/pyicloud :alt: Check out our test status at https://travis-ci.org/picklepete/pyicloud
:target: https://travis-ci.org/picklepete/pyicloud :target: https://travis-ci.org/picklepete/pyicloud
.. image:: https://img.shields.io/pypi/v/pyiCloud.svg .. image:: https://img.shields.io/pypi/v/pyicloud.svg
:target: https://pypi.org/project/pyiCloud :alt: Library version
:target: https://pypi.org/project/pyicloud
.. image:: https://img.shields.io/pypi/pyversions/pyiCloud.svg .. image:: https://img.shields.io/pypi/pyversions/pyicloud.svg
:target: https://pypi.org/project/pyiCloud :alt: Supported versions
:target: https://pypi.org/project/pyicloud
.. image:: https://pepy.tech/badge/pyicloud
:alt: Downloads
:target: https://pypi.org/project/pyicloud
.. image:: https://requires.io/github/Quentame/pyicloud/requirements.svg?branch=master .. image:: https://requires.io/github/Quentame/pyicloud/requirements.svg?branch=master
:alt: Requirements Status :alt: Requirements Status
:target: https://requires.io/github/Quentame/pyicloud/requirements/?branch=master :target: https://requires.io/github/Quentame/pyicloud/requirements/?branch=master
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:alt: Formated with Black
:target: https://github.com/psf/black :target: https://github.com/psf/black
.. image:: https://badges.gitter.im/Join%20Chat.svg .. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/picklepete/pyicloud :alt: Join the chat at https://gitter.im/picklepete/pyicloud
:target: https://gitter.im/picklepete/pyicloud?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge :target: https://gitter.im/picklepete/pyicloud?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
PyiCloud 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. PyiCloud 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.
@ -61,25 +68,25 @@ If you have enabled `two-step authentication (2SA) <https://support.apple.com/en
.. code-block:: python .. code-block:: python
if api.requires_2sa: if api.requires_2sa:
import click import click
print "Two-step authentication required. Your trusted devices are:" print "Two-step authentication required. Your trusted devices are:"
devices = api.trusted_devices devices = api.trusted_devices
for i, device in enumerate(devices): for i, device in enumerate(devices):
print " %s: %s" % (i, device.get('deviceName', print " %s: %s" % (i, device.get('deviceName',
"SMS to %s" % device.get('phoneNumber'))) "SMS to %s" % device.get('phoneNumber')))
device = click.prompt('Which device would you like to use?', default=0) device = click.prompt('Which device would you like to use?', default=0)
device = devices[device] device = devices[device]
if not api.send_verification_code(device): if not api.send_verification_code(device):
print "Failed to send verification code" print "Failed to send verification code"
sys.exit(1) sys.exit(1)
code = click.prompt('Please enter validation code') code = click.prompt('Please enter validation code')
if not api.validate_verification_code(device, code): if not api.validate_verification_code(device, code):
print "Failed to verify verification code" print "Failed to verify verification code"
sys.exit(1) sys.exit(1)
This approach also works if the account is set up for `two-factor authentication (2FA) <https://support.apple.com/en-us/HT204915>`_, but the authentication will time out after a few hours. Full support for two-factor authentication (2FA) is not implemented in PyiCloud yet. See issue `#102 <https://github.com/picklepete/pyicloud/issues/102>`_. This approach also works if the account is set up for `two-factor authentication (2FA) <https://support.apple.com/en-us/HT204915>`_, but the authentication will time out after a few hours. Full support for two-factor authentication (2FA) is not implemented in PyiCloud yet. See issue `#102 <https://github.com/picklepete/pyicloud/issues/102>`_.