Skip to content
Mbed Cloud SDK for Python
Branch: master
Clone or download
Latest commit c0af86f Mar 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci ⭕️ 2164 Upload test coverage results to codecov (#325) Mar 1, 2019
container ⬆️ 1921 Updated dependancies (fix Python 2 build issues) (#315) Nov 28, 2018
docs 🏁 📰 releasing version 2.0.6 Mar 5, 2019
examples 🔧 2068: Default for device_execution_mode removed from SDK (#329) Mar 4, 2019
scripts ⭕️ 2164 Upload test coverage results to codecov (#325) Mar 1, 2019
src/mbed_cloud 🏁 📰 releasing version 2.0.6 Mar 5, 2019
tests 🔧 2133 Fix encoding of integers when calling set_resource_value (#327) Mar 5, 2019
.dockerignore 🏁1.2.8 May 22, 2018
.gitignore Fixes for the java properties file Jul 17, 2018
CHANGELOG.rst 🏁 📰 releasing version 2.0.6 Mar 5, 2019
CONTRIBUTING.md ▶️◀️Merge branch 'master' into d/towncrier Mar 22, 2018
DEVELOPMENT.md update development.rst Dec 20, 2017
LICENCE Add licence and setup file Nov 18, 2016
MANIFEST.in
Pipfile ⭕️ 2164 Upload test coverage results to codecov (#325) Mar 1, 2019
README.rst Update circleCI badge Mar 1, 2019
requirements.txt ⬆️ 1921 Updated dependancies (fix Python 2 build issues) (#315) Nov 28, 2018
setup.cfg ⬆️ 1921 Updated dependancies (fix Python 2 build issues) (#315) Nov 28, 2018
setup.py 📰 add news and update CI to 3.7 Sep 7, 2018

README.rst

Mbed Cloud SDK for Python

The mbed-cloud-sdk gives developers access to the full Mbed Cloud suite using Python.

https://img.shields.io/circleci/project/github/ARMmbed/mbed-cloud-sdk-python/master.svg?label=circleci

Prerequisites

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

Use of virtual environments or pipenv is recommended to manage python versions and dependencies.

Installation

pip install mbed-cloud-sdk

Usage

These instructions can also be found in the official documentation:

  1. Create an API key in the Mbed Cloud Portal.

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

    {
        "api_key": "your_api_key_here"
    }
  3. Import the library and you're ready to go.

    from mbed_cloud import ConnectAPI
    connect_api = ConnectAPI()
    connect_api.list_connected_devices().first()
    {
      "id": "Device #1",
      "state": "unenrolled",
      ...
    }
    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/.

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

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.

Licence

Mbed Cloud SDK for Python is free to use and licensed under the Apache License 2.0. See LICENCE for more information.

Versioning

The current version scheme used by the SDK follows PEP440:

<SDK major>.<SDK minor>.<SDK patch>

Troubleshooting

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

  • SSL version / SSLV3_ALERT_HANDSHAKE_FAILURE
    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 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 python -c "import ssl; print(ssl.OPENSSL_VERSION)"

You can’t perform that action at this time.