Metadata-Version: 2.1
Name: mbed-cloud-sdk
Version: 2.0.2
Summary: Mbed Cloud Python SDK
Home-page: https://github.com/ARMmbed/mbed-cloud-sdk-python
Author: Arkadiusz Zaluski, David Hyman, Herman Schistad
Author-email: support@mbed.com
License: Apache 2.0
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Embedded Systems
Classifier: Topic :: Software Development :: Object Brokering
Requires-Python: >=2.7.10, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.0, !=3.4.1, !=3.4.2, <4
Requires-Dist: urllib3 (>=1.15)
Requires-Dist: six (>=1.10)
Requires-Dist: certifi (>=2017)
Requires-Dist: python-dateutil (>=2)
Requires-Dist: future (>=0.16)
Requires-Dist: python-dotenv (>=0.8.2)

Mbed Cloud SDK for Python
=========================

The ``mbed-cloud-sdk`` gives developers access to the full `Mbed Cloud suite <https://cloud.mbed.com/>`__ using Python.

.. image:: https://img.shields.io/pypi/l/mbed-cloud-sdk.svg
    :target: https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/master/LICENCE

.. image:: https://img.shields.io/pypi/v/mbed-cloud-sdk.svg
    :target: https://pypi.org/project/mbed-cloud-sdk/

.. image:: https://img.shields.io/pypi/pyversions/mbed-cloud-sdk.svg
    :target: https://pypi.org/project/mbed-cloud-sdk/

.. image:: https://img.shields.io/pypi/status/mbed-cloud-sdk.svg
    :target: https://pypi.org/project/mbed-cloud-sdk/

.. image:: https://circleci.com/gh/ARMmbed/mbed-cloud-sdk-python/tree/master.svg?style=shield&circle-token=ec05043ded945f81984e7fd2fce23fe793e7b634
    :target: https://circleci.com/gh/ARMmbed/mbed-cloud-sdk-python/tree/master

.. image:: https://codecov.io/gh/ARMmbed/mbed-cloud-sdk-python/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/ARMmbed/mbed-cloud-sdk-python

.. common_content_anchor

Prerequisites
-------------

Python 2.7.10+ / Python 3.4.3, built with SSL support.

Use of `virtual
environments <http://docs.python-guide.org/en/latest/dev/virtualenvs/>`__
or `pipenv <https://docs.pipenv.org/>`__ is recommended to manage python versions and dependencies.

Installation
------------

.. code:: bash

    pip install mbed-cloud-sdk

Usage
-----

These instructions can also be found in the `official
documentation <https://cloud.mbed.com/docs/latest/mbed-cloud-sdk-python/>`__:

1. Create an API key in the `Mbed Cloud
   Portal <https://portal.us-east-1.mbedcloud.com/>`__.

2. Create a configuration file in your ``$HOME`` or project directory
   (``.mbed_cloud_config.json``):

   .. code:: javascript

       {
           "api_key": "your_api_key_here"
       }

3. Import the library and you're ready to go.

   .. code:: python

       from mbed_cloud import ConnectAPI
       connect_api = ConnectAPI()
       connect_api.list_connected_devices().first()
       {
         "id": "Device #1",
         "state": "unenrolled",
         ...
       }

   .. code:: python

       from mbed_cloud import AccountManagementAPI
       api = AccountManagementAPI()
       for user in api.list_users():
          print(user)
       {
         "email": "username@example.org",
         "full_name": "A.N. Individual",
         ...
       }

Documentation and examples
--------------------------

The full documentation and API reference is hosted here: https://cloud.mbed.com/docs/latest/mbed-cloud-sdk-python/.

.. _examples directory: https://github.com/ARMmbed/mbed-cloud-sdk-python/tree/master/examples

See the `examples directory`_ for a collection of use-cases of this API, e.g.:

:code:`python examples/connect/list-connected-devices.py`

Contributing
------------

Mbed Cloud SDK for Python is open source and we would like your help; there
is a brief guide on how to get started in `CONTRIBUTING.md <https://github.com/ARMmbed/mbed-cloud-sdk-python/tree/master/CONTRIBUTING.md>`__.

Licence
-------

Mbed Cloud SDK for Python is free to use and licensed under the Apache
License 2.0. See `LICENCE <https://github.com/ARMmbed/mbed-cloud-sdk-python/tree/master/LICENCE>`__ for more information.

Versioning
----------

The current version scheme used by the SDK follows PEP440:

:code:`<SDK major>.<SDK minor>.<SDK patch>`

Troubleshooting
---------------
Suggestions for issues that have been reported when using the SDK.

- SSL version / :code:`SSLV3_ALERT_HANDSHAKE_FAILURE`
    .. code:: python

        urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.us-east-1.mbedcloud.com', port=443):
        Max retries exceeded with url: /v3/firmware-images/
        (Caused by SSLError(SSLError(1, u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)'),))

    This probably means the Python interpreter being used has an old version of SSL. The recommended minimum version for the SDK is
    :code:`1.0.2`,
    however security best practice is to use the latest available version of SSL, which can be found here:
    https://www.openssl.org.
    It is recommended to upgrade/rebuild the Python interpreter with the latest available SSL library.
    The SSL version currently in use by the Python interpreter can be found using
    :code:`python -c "import ssl; print(ssl.OPENSSL_VERSION)"`


