diff --git a/device/readme.md b/device/readme.md index 24455716a..aa6f3a8a2 100644 --- a/device/readme.md +++ b/device/readme.md @@ -14,23 +14,10 @@ Use the device SDK to: ## How to use the Azure IoT device SDK for Python -* [Get started in minutes with the PyPI package][PyPI-install-instructions] -* [Check out the simple samples provided in this repository][run-samples] - -## Application development guides -For more information on how to use this library refer to the documents below: -- [Prepare your Python development environment][devbox-setup] -- [Setup IoT Hub and provision devices][setup-iothub] -- [Run a Python sample application][run-samples] +* [Check out the simple samples provided in this repository][samples] ## Samples -Whithin the repository, you can find various types of simple samples that can help you get started. -And if you are looking for end to end samples that show how to do simple analytics and processing of the data generated by your device using Azure services such as Stream Analytics, Big Data, Machine Learning and others, check out our [E2E samples gallery](http://aka.ms/azureiotsamples). -To run the samples, you can follow [these instructions][run-samples] - -* [Simple Sample](samples/iothub_client_sample.py): shows how to connect to IoT Hub and send and receive messages using the AMQP, MQTT or HTTP protocol. -* [Class Sample using AMQP](samples/iothub_client_sample_class.py): shows how to connect to IoT Hub with a HubManager class to send and receive messages using the AMQP protocol. -* [Simple Sample X-509](samples/iothub_client_sample_x509.py): shows how to authenticate a device using X-509 certs and send and receive messages. +Whithin the repository, you can find various types of [simple samples][samples] that can help you get started. ## Directory structure @@ -48,7 +35,4 @@ Sample Python applications excercising basic features using AMQP, MQTT and HTTP. Python C extension module unit tests. The unit tests exercise a mocked Python extension module to test the Python interface. -[setup-iothub]: https://aka.ms/howtocreateazureiothub -[devbox-setup]: ../doc/python-devbox-setup.md -[run-samples]: ../doc/python-run-sample.md -[PyPI-install-instructions]: ../doc/python-devbox-setup.md#windows-wheels +[samples]: samples/ diff --git a/device/samples/readme.md b/device/samples/readme.md new file mode 100644 index 000000000..3a7a3654b --- /dev/null +++ b/device/samples/readme.md @@ -0,0 +1,34 @@ +# Samples for the Azure IoT device SDK for Python + +This folder contains simple samples showing how to use the various features of the Microsoft Azure IoT Hub service from a device running Python. + +## List of samples + +* [Simple Sample](iothub_client_sample.py): shows how to connect to IoT Hub and send and receive messages using the AMQP, MQTT or HTTP protocol. +* [Class Sample using AMQP](iothub_client_sample_class.py): shows how to connect to IoT Hub with a HubManager class to send and receive messages using the AMQP protocol. +* [Simple Sample X-509](iothub_client_sample_x509.py): shows how to authenticate a device using X-509 certs and send and receive messages. + +And if you are looking for end to end samples that show how to do simple analytics and processing of the data generated by your device using Azure services such as Stream Analytics, Big Data, Machine Learning and others, check out our [E2E samples gallery](http://aka.ms/azureiotsamples). + +## How to run the samples +In order to run the device samples you will first need the following prerequisites: +* [Setup your development environment][devbox-setup] +> Note: On Windows, it is recommended to install the **iothub-client** module package using pip (see link above). +* [Create an Azure IoT Hub instance][lnk-setup-iot-hub] +* [Create a device identity for your device][lnk-manage-iot-hub] and retreive the primary connection string for this device + +Once you have a device identity for your sample, +* Get the sample files: + * if you have cloned the repository, Navigate to the folder **device/samples** + * if you are using the iothub_client module installed with pip, download the samples folder content to your target. +* Run the sample application using the following command to run the simple sample (replacing `` with the one generated previously): + ``` + python iothub_client_sample.py -c < device connection string > -p < mqtt|http|amqp > + ``` +> You can get details on the options for the sample command line typing: +> `python iothub_client_sample.py -h` +* To run the other samples (x-509 and class), replace the name of the .py file in the command line and use the `-h` option to get the details on the available options + +[lnk-setup-iot-hub]: https://aka.ms/howtocreateazureiothub +[lnk-manage-iot-hub]: https://aka.ms/manageiothub +[devbox-setup]: ../../doc/python-devbox-setup.md \ No newline at end of file diff --git a/device/thirdpartynotice.txt b/device/thirdpartynotice.txt deleted file mode 100644 index 78d351a9e..000000000 --- a/device/thirdpartynotice.txt +++ /dev/null @@ -1,35 +0,0 @@ -Third Party Notices for Azure IoT SDKs project - -This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). -Microsoft Corporation is not the original author of the Third Party Code. -The original copyright notice and license, under which Microsoft Corporation received such Third Party Code, -are set out below. This Third Party Code is licensed to you under their original license terms set forth below. -Microsoft Corporation reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. - -1. Boost v. 1.60, obtained from http://www.boost.org -/* -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - diff --git a/doc/faq.md b/doc/faq.md deleted file mode 100644 index f9dfa615f..000000000 --- a/doc/faq.md +++ /dev/null @@ -1,196 +0,0 @@ -# Microsoft Azure IoT device SDK FAQ - -This document contains both general FAQs about the Microsoft Azure IoT device SDK as a whole, and specific FAQs about the C, .NET, Java, and Node.js SDKs in this repository ([azure-iot-sdks](https://github.com/Azure/azure-iot-sdks)). - -**Microsoft Azure IoT SDKs** - -- [Using Visual Studio 2013](#vs2013) -- [Line-endings in repository zip archive](#lineendings) - -**Microsoft Azure IoT device SDK for C FAQs** - -- [Installing CMake manually](#cmake) -- [Using the IoT Hub c-client libraries in C++](#cpp) - -**Microsoft Azure IoT device SDK for .NET FAQs** - -- [UWP support for Microsoft.Azure.Devices.Client](#uwpsupport) -- [NotImplementedException thrown when using UWP](#notimpluwp) -- [IotHubCommunicationException or FileNotFoundException thrown when using HTTP protocol](#httpexception) - -**Microsoft Azure IoT device SDK for Java FAQs** - -- [Error when using AMQP on Raspberry Pi2](#javapi2error) -- [qpid-jms build fails](#qpidjmsbuildfail) - -**Microsoft Azure IoT SDK for Node.js FAQs** - -- [Using promises instead of callbacks with the device client](#nodepromisify) -- [Why not use Typescript instead of Javascript?](#whyunotypescript) - - -## Using Visual Studio 2013 - -The Visual Studio native C projects included in this repository ([azure-iot-sdks](https://github.com/Azure/azure-iot-sdks)) are Visual Studio 2015 projects. The following steps describe how to use Visual Studio 2013 if you are unable to install Visual Studio 2015 on your development machine. - -Note: You can download the free Community edition of Visual Studio 2015 [here](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx). - -1. Open the native C solution in Visual Studio 2013 (for example, azure_iot_sdks.sln in your home folder). -2. In **Solution Explorer** select all the projects in the solution. The right-click in **Solution Explorer** and click **Properties**. -3. Expand **Configuration Properties**, and then select **General**. -4. Change the **Platform Toolset** to **Visual Studio 2013 (v120)**, then click **OK**. - - ![][1] - - -## Line-endings in repository zip archive - -If you download a zip archive of this repository to a Windows machine, you may encounter errors when you run some of the scripts. This is due to the way GitHub handles line-endings in zip archives. For more information, see http://stackoverflow.com/questions/17347611/downloading-a-zip-from-github-removes-newlines-from-text-files. - - -## Installing CMake manually - -If your Linux OS does not include CMake 3.0 and it is not possible to use a package installer, you can install CMake as follows: - -``` -wget https://cmake.org/files/v3.4/cmake-3.4.0-Linux-i386.sh -chmod u+x cmake-3.4.0-Linux-i386.sh -./cmake-3.4.0-Linux-i386.sh --help -Usage: ./cmake-3.4.0-Linux-i386.sh [options] -Options: [defaults in brackets after descriptions] - --help print this message - --prefix=dir directory in which to install - --include-subdir include the cmake-3.4.0-Linux-i386 subdirectory - --exclude-subdir exclude the cmake-3.4.0-Linux-i386 subdirectory -``` - -Make sure that the directory where you install CMake is on your path by exporting it. Alternatively, if you use the option `--prefix=/usr` when you install CMake it replaces your current installation. - - -## Using the IoT Hub c-client libraries in C++ - -Using the IoT Hub c-client code from C++ is no different than using it from c. Create your C++ project, then reference the client library as you normally would in c++, or install the package via the appropriate package manager based on your platform. - - -## UWP support for Microsoft.Azure.Devices.Client - -- [Overview](#overview) -- [Project file and assembly](#project) -- [Device client](#deviceclient) -- [Asynchrony](#asynchrony) -- [Library-specific behaviors](#library) -- [Resources](#resources) - - -### Overview: Why UWP? - -UWP (Universal Windows Platform) is an evolution of Windows app model introduced in Windows 8. UWP provides a common app platform available on every device that runs Windows 10, including its IoT flavor, the IoT Core. (See https://msdn.microsoft.com/en-us/library/dn894631.aspx). UWP is the official application model supported on IoT Core. - -An existing .NET library can be made UWP-compatible by exposing WinRT interfaces and by porting the implementation to .NET Core (See http://blogs.msdn.com/b/dotnet/archive/2014/12/04/introducing-net-core.aspx) - -WinRT imposes certain constraints on the public APIs. Most importantly, only WinRT (and not .NET) types can be exposed. This allows other languages (including unmanaged languages like C++/CX and JavaScript) to consume such libraries. - - -### Project file and assembly - -A new project file, Microsoft.Azure.Devices.Client.WinRT.csproj has been created. The project has been added to the main solution. The project produces a WinRT AppX package with metadata in Microsoft.Azure.Devices.Client.winmd. - -The existing .NET library, Microsoft.Azure.Devices.Client.dll, has remained unchanged (modulo a small number of breaking changes as described below). - - -### DeviceClient - -WinRT does not allow exporting abstract classes, therefore **DeviceClient** has become a sealed concrete class. A new private abstract class, **DeviceClientImpl** has been added to maximally reuse the existing implementation. - - -### Asynchrony - -Only WinRT types can be exported by WinRT assemblies. The signatures of async methods such as **ReceiveAsync** have been changed to return **AsyncTask** or **AsyncTaskOfMessage**, which is aliased to **Windows.Foundation.IAsyncAction** or **Windows.Foundation.IAsyncOperation** for WinRT, or **System.Threading.Tasks.Task** and **System.Threading.Tasks.Task** for .NET. - - -### Library-specific Behaviors - -WINDOWS_UWP macro is used to differentiate between .NET and UWP behaviors at compile time. Currently, there are almost 200 occurrences of `#if WINDOWS_UWP` in the code. - - -#### Resources - -Desktop apps use either text files or XML (.resx) files to create resources. The compiler then embeds them into the assembly. The resources are retrieved using the System.Resources.ResourceManager class. - -UWP uses the Windows Store resource model that replaces the hub-and-spoke model common to .NET Framework desktop apps. In UWP apps, .resw files are used to create resources. The format of the file is the same as .resx, but the packaging mechanism is different. At compile time, all the .resw files for an app are packed into a single PRI file by the MakePRI utility and included with the app's deployment package. At run time, the **Windows.ApplicationModel.Resources.ResourceLoader** class and the types in the **Windows.ApplicationModel.Resources.Core** namespace provide access to app resources. - -To support resources in Microsoft.Azure.Devices.Client library, the existing Resource.resx file has been copied to Resource.resw. The two files will now need to be kept in sync. Unlike in the .NET version of the library, the UWP version does not contain generated C# files. Instead, a new file, WinRTResources.cs is introduced. Whenever a new string is added to the .resx/.resw file, a corresponding entry must be copied from Resources.Designer.cs to WinRTResources.cs (follow the existing entries as an example) - - -## System.NotImplementedException occurred in Microsoft.Azure.Devices.Client.winmd -The Universal Windows Platform (UWP) version of the .NET client device library does **not** currently support **MQTT** protocol. - -For example, calling `DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(DeviceConnectionString, TransportType.Mqtt);` -will result in "Mqtt protocol is not supported" exception. - - -## IotHubCommunicationException or FileNotFoundException thrown when using HTTP protocol - -The **DeviceClient** class in the Microsoft.Azure.Devices.Client package requires the **System.Net.Http.Formatting** class to communicate with IoT Hub over HTTP. - -You see an **IotHubCommunicationException** or **FileNotFoundException** exception when you try to use the HTTP protocol to send a device-to-cloud message: - -``` -DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(DeviceConnectionString, TransportType.Http1); - -... - -await deviceClient.SendEventAsync(eventMessage); -``` - -To prevent these exceptions from happening, you should add **Microsoft.AspNet.WebApi.Client** NuGet package to your project. - - -## Error when using AMQP on Raspberry Pi2 -When building Qpid using Maven on a Raspberry Pi2 you might encounter a known error with the *SureFire* plugin: - -``` -Error occurred during initialization of VM Could not reserve enough space for object heap - -Error: Could not create the Java Virtual Machine. -``` -This results in a failure to build Qpid. This is a known issue with OpenJDK7 (for more information, see http://laurenthinoul.com/how-to-solve-the-maven-vm-initialization-error/). This article recommends updating SureFire by updating your pom file. As an alternative, you can opt to skip the SureFire tests with the Maven build, using the following command: - -``` -mvn install -Dmaven.test.skip=true -``` - -For more information, see http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html. - - -## qpid-jms build fails - -If you get a build error when you try to [build qpid-jms](get_started/java-devbox-setup.md), then you should set the following variable in your environment before you run `mvn install`. - -Windows: `set _JAVA_OPTIONS=-Xmx512M` - -Linux: `export _JAVA_OPTIONS=-Xmx512M` - -[1]: media/PlatformToolset.png - - -## Using promises instead of callbacks with the device client -Currently the device client asynchronous functions follow the callback pattern rather than returning promises. If you wish to use the SDK with promises instead of callbacks, it's extremely easy though, using the bluebird library to "promisify" the device client class. - -```javascript -var Promise = require('bluebird'); -var client = Promise.promisifyAll(Client.fromConnectionString(connectionString, Amqp)); -``` - -And there you have it. All the existing functions of the client still exist, and the promise-returning equivalent has been created and has the same name with `Async` appended to it. In other words: -- `client.open(callback)` becomes `client.openAsync().then(...).catch(...)` -- `client.send(message, callback)` becomes `client.sendAsync(message).then(...).catch(...)` -- `client.complete(message, callback)` becomes `client.completeAsync(message).then(...).catch(...)` -- etc. - -Events are unchanged, so you still subscribe to those the way you would with the un-promisified client. - - -## Why not use TypeScript instead of JavaScript for the SDK? -At the time when the SDK development was started, pure JavaScript felt like a better choice in order to make contributions as easy as possible for any Node developer, whether or not he or she was aware and proficient with TypesSript. -We regularly re-evaluate this decision as we move forward and you are most welcome to provide feedback or contribute by opening issues or pull-requests and help us decide what to do in the future. diff --git a/doc/get_started/python-devbox-setup.md b/doc/get_started/python-devbox-setup.md deleted file mode 100644 index 0dfb8e4ad..000000000 --- a/doc/get_started/python-devbox-setup.md +++ /dev/null @@ -1,119 +0,0 @@ -# Prepare your development environment - -This document describes how to prepare your development environment to use the *Microsoft Azure IoT Device and Service SDK for Python*. - -- [Setup your development environment](#devenv) -- [Build the samples on Linux](#linux) -- [Install on Windows using PyPI wheels](#windows-wheels) -- [Build the samples on Windows using nuget packages](#windows) -- [Build the samples on Windows using cmake and boost libraries](#windows-cmake) -- [Sample applications](#samplecode) - - -## Setup your development environment - -Complete the following steps to set up your development environment: - -- Follow the instructions to setup [Microsoft Azure IoT device SDK for C][setup-devbox]. -- Ensure that the desired Python version is installed (2.7.x, 3.4.x or 3.5.x). Run `python --version` or `python3 --version` at the command line to check the version. - - On Linux, Python 2.7 is typically already installed and active. - - On Windows, install the latest x86 or x64 Python 2.7 or 3.x client from ([python.org](https://www.python.org/downloads/)). The build needs a valid Python.exe in the path. Based on the active Python version (e.g. Python 2.7.11 x86 32bit) the build script choses the compiler settings for the Python extension module build accordingly and copies the extension to the test and sample folder. -- When you have installed Python, make sure you cloned the latest version of this repository ([azure-iot-sdks](https://github.com/Azure/azure-iot-sdks)) to your development machine or device. You should always use the **master** branch for the latest version of the libraries and samples. - - -## Build the Python iothub_client and iothub_service_client module on Linux - -The Python module builds on the Azure IoT device SDK for C. Please make sure you can build the C samples as described in [setup-devbox] before you continue in this section. - -The Python iothub_client supports python versions 2.7.x, 3.4.x or 3.5.x. Know the appropriate version you would like to build the library with for the following instructions. - -1. Ensure that the desired Python version (2.7.x, 3.4 or 3.5.x) is installed and active. Run `python --version` or `python3 --version` at the command line to check the version. -2. Open a shell and navigate to the folder **python/build_all/linux** in your local copy of the repository. -3. Run the `./setup.sh` script to install the prerequisite packages and the dependent libraries. - * Setup will default to python 2.7 - * To setup dependencies for python 3.4 or 3.5, run `./setup.sh --python-version 3.4` or `./setup.sh --python-version 3.5` respectively -4. Run the `./build.sh` script. - * Build will default to python 2.7 - * To build with python 3.4 or 3.5, run `./build.sh --build-python 3.4` or `./build.sh --build-python 3.5` respectively -5. After a successful build, the `iothub_client.so` Python extension module is copied to the **python/device/samples** folder and the `iothub_service_client.so` Python extension module is copied to the **python/service/samples** folder. Please follow instructions in [Sample applications](#samplecode) to run the Python samples. - -###Known build issues: -1. On some small footprint Linux devices, like a *Raspberry Pi* using Raspbian OS, the following build error may occur: `virtual memory exhausted: Cannot allocate memory`. In such a case please try to increase the swap file size on your platform and retry the build. (If swap increase did not work consider running build.sh using --skip-unittests --use-websockets parameters) -2. CentOS7: Only Python 2.7 is supported due to a missing boost-python3 library package - - -## Install the Python iothub_client module on Windows from [PyPI] - -The following instructions outline how you can install the **iothub\_client** module in Windows from [PyPi] using the **iothub\_client** package: - -1. Open a command-prompt window. -2. Install the **iothub\_client** package with the following command: `pip install iothub-client` -3. Now Python is ready to run the sample applications. -Please follow instructions in [Sample applications](#samplecode) to run the Python samples. - -> Note: If it is not already installed, you need to install the [Visual C++ Redistributable for Visual Studio 2015][lnk-c-redist]. - -> Note: If Pip cannot install the package for the specific version of Python installed on your machine, use one of the following options to build the **iothub_client** module. - -## Install the Python iothub_service_client module on Windows from [PyPI] - -The following instructions outline how you can install the **iothub\_service_client** module in Windows from [PyPi] using the **iothub\_service_client** package: - -1. Open a command-prompt window. -2. Install the **iothub\_service_client** package with the following command: `pip install iothub-service-client` -3. Now Python is ready to run the sample applications. -Please follow instructions in [Sample applications](#samplecode) to run the Python samples. - -> Note: If it is not already installed, you need to install the [Visual C++ Redistributable for Visual Studio 2015][lnk-c-redist]. - -> Note: If Pip cannot install the package for the specific version of Python installed on your machine, use one of the following options to build the **iothub_service_client** module. - - -## Build the Python iothub_client module on Windows using Nuget packages (recommended) - -The following instructions outline how you can build the libraries in Windows: - -1. Open a Visual Studio 2015 x86 Native Tools command prompt and navigate to the folder **python/build_all/windows** in your local copy of the repository. -2. Run the script `build.cmd` in the **python\\build_all\\windows** directory. -3. As a result, the `iothub_client.pyd` Python extension module is copied to the **python/device/samples** folder and the `iothub_service_client.pyd` Python extension module is copied to the **python/service/samples** folder. Follow the instructions in [Sample applications](#samplecode) to run the Python IoT Hub samples. -4. In order to run the samples with a different Python version (e.g. 32bit vs. 64bit or 2.7 vs. 3.4) please rebuild the `iothub_service_client.pyd` extension. - - -## Build the Python iothub_client module on Windows using cmake and boost libraries - -###The following instructions outline how you prepare the boost::python libraries in Windows. -This step is only required once and only necessary for the cmake build: - -1. Open a Visual Studio 2015 x86 or x64 Native Tools command prompt, depending on your installed Python version. -2. Download the zip version of the boost 1.60 library for windows from [boost-zip]. -3. Unpack zip to a local folder, e.g. **C:\boost_1_60_0**. -4. Navigate to the root folder of the boost library, e.g. **C:\boost_1_60_0**. -5. Run the script `bootstrap.bat` in the boost folder. -6. At this point the desired Python version (e.g. V3.4 64bit) must be installed and active in the `PATH` environment variable. -7. Run the build command `b2` in the same folder. For x64 builds use the build command `b2 address-model=64`. -8. Set the environment variable **BOOST_ROOT** to the boost folder using the command `SET BOOST_ROOT=C:\boost_1_60_0`. - -Now the boost::python library is ready for use. - -Important note: The boost libraries can only be used to build for a single Python version (e.g. V3.4 64bit). In order to build with cmake for another Python version, a clean bootstrap and build of the boost libraries for that version is necessary, or build errors will occur. It is possible to have multiple boost libraries for different Python versions side by side in different roots. Then the **BOOST_ROOT** folder must point to the appropriate boost library at cmake build time. - -###The following instructions outline how you can build the Python extension module with cmake in Windows: - -1. Open a Visual Studio 2015 x86 Native Tools command prompt and navigate to the folder **python/build_all/windows** in your local copy of the repository. -2. Verify that `BOOST_ROOT` points to the local boost installation for the right Python version. -3. Run the script `build_client.cmd` in the **python\\build_all\\windows** directory. -4. After a successful build, the `iothub_client.pyd` Python extension module is copied to the **python/device/samples** folder and the `iothub_service_client.pyd` Python extension module is copied to the **python/service/samples** folder. Please follow instructions in [Sample applications](#samplecode) to run the Python samples. - -To use the iothub_client and iothub_service_client extension for native code debugging with [Python Tools for Visual Studio] run the script: `build_client.cmd --config Debug` to get the full debug symbol support. - - -## Sample applications - -This repository contains various Python sample applications that illustrate how to use the Microsoft Azure IoT SDK for Python. To learn how to run a sample application that sends messages to an IoT hub, see [Getting started - running a Python sample application][getstarted]. - -[python-2.7 or python-3.5]: https://www.python.org/downloads/ -[PyPI]: https://pypi.python.org/pypi/iothub-client/ -[Python Tools for Visual Studio]: https://www.visualstudio.com/en-us/features/python-vs.aspx -[getstarted]: python-run-sample.md -[boost-zip]: http://www.boost.org/users/history/version_1_60_0.html -[lnk-c-redist]: https://www.microsoft.com/download/details.aspx?id=48145 \ No newline at end of file diff --git a/doc/get_started/python-run-sample.md b/doc/get_started/python-run-sample.md deleted file mode 100644 index 5bbfad6a7..000000000 --- a/doc/get_started/python-run-sample.md +++ /dev/null @@ -1,182 +0,0 @@ ---- -platform: Debian, Linux, Raspbian, Ubuntu, Windows -device: any -language: Python ---- - -Run a simple Python sample on device -=== ---- - -# Table of Contents - -- [Introduction](#Introduction) -- [Step 1: Prerequisites](#Prerequisites) -- [Step 2: Prepare your Device](#PrepareDevice) -- [Step 3: Run the Sample](#Run) - - -# Introduction - -**About this document** - -This document describes how to run the **iothub_client_sample.py** and **iothub_service_client_sample.py** Python sample application. This multi-step process includes: -- Configuring Azure IoT Hub -- Registering your IoT device -- Build and deploy Azure IoT SDK on device - - -# Step 1: Prerequisites - -You should have the following items ready before beginning the process: -- Computer with Git client installed and access to the - [azure-iot-sdk-python](https://github.com/Azure/azure-iot-sdk-python) GitHub public repository. -- [Prepare your development environment][lnk-python-devbox-setup] -- [Setup your IoT hub][lnk-setup-iot-hub] -- [Provision your device and get its credentials][lnk-manage-iot-hub] - - -# Step 2: Prepare your Device - -- Make sure desktop is ready as per instructions given on [Prepare your development environment][lnk-python-devbox-setup]. - -> Note: On Windows, you can install the **iothub-client** and **iothub-service-client** module package using Pip as described in [Prepare your development environment][lnk-python-devbox-setup]. - - -# Step 3: Run the Device Client sample - -- Navigate to the folder **python/device/samples** in your local copy of the repository. - -- Open the file **iothub_client_sample.py** in a text editor. - -- Locate the following code in the file: - - ``` - connectionString = "[device connection string]" - ``` - -- Replace `[device connection string]` with the connection string for your device. Save the changes. - -- Run the sample application using the following command: - - ``` - python iothub_client_sample.py - ``` - -- The sample application will send messages to your IoT hub. The **iothub-explorer** utility will display the messages as your IoT hub receives them. - -If you receive the error "ImportError: dynamic module does not define module export function (PyInit_iothub_client)" you may be running the samples with a different version of python than the iothub_client was build with. Following the [Prepare your development environment](#python-devbox-setup) to ensure the library is built with the desired python version - - -# Step 4: Run the Service Client - Registry Manager sample - -- Navigate to the folder **python/service/samples** in your local copy of the repository. - -- Open the file **iothub_registrymanager_sample.py** in a text editor. - -- Locate the following code in the file: - - ``` - connectionString = "[IoTHub Connection String]" - deviceId = "[Device Id]" - ``` - -- Replace `[IoTHub Connection String]` with the connection string for your IoTHub and the `[Device Id]` with the sample device name (device will be created and deleted by the sample). Save the changes. - -- Run the sample application using the following command: - - ``` - python iothub_registrymanager_sample.py - ``` - -- The sample application will do CRUD and Get/Update operations with the given device name. With the **iothub-explorer** you can follow the operations (debug). - - -# Step 5: Run the Service Client - Messaging sample - -- Navigate to the folder **python/service/samples** in your local copy of the repository. - -- Open the file **iothub_messaging_sample.py** in a text editor. - -- Locate the following code in the file: - - ``` - connectionString = "[IoTHub Connection String]" - deviceId = "[Device Id]" - ``` - -- Replace `[IoTHub Connection String]` with the connection string for your IoTHub and the `[Device Id]` with the sample device name (device will be created and deleted by the sample). Save the changes. - -- Run the sample application using the following command: - - ``` - python iothub_messaging_sample.py - ``` - -- The sample application will send messages to and receive feedbacks from the given device. - -If you receive the error "ImportError: dynamic module does not define module export function (PyInit_iothub_service_client)" you may be running the samples with a different version of python than the iothub_service_client was build with. Following the [Prepare your development environment](#python-devbox-setup) to ensure the library is built with the desired python version - - -# Step 6: Run the Service Client - Device Method sample - -- Navigate to the folder **python/service/samples** in your local copy of the repository. - -- Open the file **iothub_devicemethod_sample.py** in a text editor. - -- Locate the following code in the file: - - ``` - connectionString = "[IoTHub Connection String]" - deviceId = "[Device Id]" - methodName = "MethodName" - methodPayload = "MethodPayload" - timeout = 60 - ``` - -- Replace `[IoTHub Connection String]` with the connection string for your IoTHub and the `[Device Id]` with the device name where you want to call the method on. Optionally, replace the `[methodName]`, `[methodPayload]` and `[timeout]`. Save the changes. - -- Run the sample application using the following command: - - ``` - python iothub_devicemethod_sample.py - ``` - -- The sample application will send messages to and receive feedbacks from the given device. - -If you receive the error "ImportError: dynamic module does not define module export function (PyInit_iothub_service_client)" you may be running the samples with a different version of python than the iothub_service_client was build with. Following the [Prepare your development environment](#python-devbox-setup) to ensure the library is built with the desired python version - - -# Step 7: Run the Service Client - Device Twin sample - -- Navigate to the folder **python/service/samples** in your local copy of the repository. - -- Open the file **iothub_devicetwin_sample.py** in a text editor. - -- Locate the following code in the file: - - ``` - connectionString = "[IoTHub Connection String]" - deviceId = "[Device Id]" - updateJson = "{\"properties\":{\"desired\":{\"telemetryInterval\":120}}}"; - ``` - -- Replace `[IoTHub Connection String]` with the connection string for your IoTHub and the `[Device Id]` with the device name what you want to use for twin operations. Optionally, replace the `[updateJson]`. Save the changes. - -- Run the sample application using the following command: - - ``` - python iothub_devicetwin_sample.py - ``` - -- The sample application will send messages to and receive feedbacks from the given device. - -If you receive the error "ImportError: dynamic module does not define module export function (PyInit_iothub_service_client)" you may be running the samples with a different version of python than the iothub_service_client was build with. Following the [Prepare your development environment](#python-devbox-setup) to ensure the library is built with the desired python version - -# Debugging the samples (and/or your code) -[Visual Studio Code](https://code.visualstudio.com/) provides an excellent environment to write and debug Python code: -- [Python Tools for Visual Studio](https://www.visualstudio.com/en-us/features/python-vs.aspx) - -[lnk-setup-iot-hub]: ../setup_iothub.md -[lnk-manage-iot-hub]: ../manage_iot_hub.md -[lnk-python-devbox-setup]: python-devbox-setup.md diff --git a/doc/python-devbox-setup.md b/doc/python-devbox-setup.md index 7533c19aa..c54c284eb 100644 --- a/doc/python-devbox-setup.md +++ b/doc/python-devbox-setup.md @@ -1,28 +1,42 @@ # Prepare your development environment -This document describes how to prepare your development environment to use the *Microsoft Azure IoT SDK for Python*. +This document describes how to prepare your development environment to use the *Microsoft Azure IoT SDKs for Python*. - [Setup your development environment](#devenv) -- [Build the samples on Linux](#linux) - [Install on Windows using PyPI wheels](#windows-wheels) +- [Build the samples on Linux](#linux) - [Build the samples on Windows using nuget packages](#windows) - [Build the samples on Windows using cmake and boost libraries](#windows-cmake) - [Sample applications](#samplecode) - + ## Setup your development environment -Complete the following steps to set up your development environment: +Ensure that the desired Python version is installed (2.7.x, 3.4.x or 3.5.x). Run `python --version` or `python3 --version` at the command line to check the version. +* On Linux, Python 2.7 is typically already installed and active. +* On Windows, install the latest x86 or x64 Python 2.7 or 3.x client from ([python.org](https://www.python.org/downloads/)). If you plan to build the Python library, the scrips will need a valid Python.exe in the path. Based on the active Python version (e.g. Python 2.7.11 x86 32bit) the build script choses the compiler settings for the Python extension module build accordingly and copies the extension to the test and sample folders. -- Ensure that the desired Python version is installed (2.7.x, 3.4.x or 3.5.x). Run `python --version` or `python3 --version` at the command line to check the version. - - On Linux, Python 2.7 is typically already installed and active. - - On Windows, install the latest x86 or x64 Python 2.7 or 3.x client from ([python.org](https://www.python.org/downloads/)). The build needs a valid Python.exe in the path. Based on the active Python version (e.g. Python 2.7.11 x86 32bit) the build script choses the compiler settings for the Python extension module build accordingly and copies the extension to the test and sample folder. -- When you have installed Python, make sure you cloned the latest version of this repository ([azure-iot-sdk-python](https://github.com/Azure/azure-iot-sdk-python)) to your development machine or device. You should always use the **master** branch for the latest version of the libraries and samples. Also, when cloning the repository, you should use the ```--recursive``` option to to retrieve the submodules. + +## Install the Python modules on Windows from [PyPI] - -## Build the Python iothub_client module on Linux +1. Open a command-prompt window. +2. To install the Azure IoT Hub device client module (**iothub\_client** package), type the following command: `pip install iothub-client` +2. To install the Azure IoT Hub service client module (**iothub\_service\_client** package), type the following command: `pip install iothub-service-client` +3. Now Python is ready to run your application. + +> Note: If Pip cannot install the package for the specific version of Python installed on your machine, use one of the following options to build the **iothub_client** module. -The Python iothub_client supports python versions 2.7.x, 3.4.x or 3.5.x. Know the appropriate version you would like to build the library with for the following instructions. + +## Build the Azure IoT Hub SDKs for Python on Linux + +### Installs needed to compile the SDKs for Python from souce code +Because the Azure IoT SDKs for Python are wrappers on top of the [SDKs for C][azure-iot-sdk-c], you will need to compile the C libraries if you want or need to generate the Python libraries from source code. +You will notice that the C SDKs are brought in as submodules to the current repository. +In order to setup your development environment to build the C binaries, you need to follow the instructions [here][c-devbox-setup]: +* On Linux you will need gcc, cmake and git + +### Compile the Python modules +The Python iothub_client and iothub_service_client modules support python versions 2.7.x, 3.4.x or 3.5.x. Know the appropriate version you would like to build the library with for the following instructions. 1. Ensure that the desired Python version (2.7.x, 3.4 or 3.5.x) is installed and active. Run `python --version` or `python3 --version` at the command line to check the version. 2. Open a shell and navigate to the folder **build_all/linux** in your local copy of the repository. @@ -32,7 +46,7 @@ The Python iothub_client supports python versions 2.7.x, 3.4.x or 3.5.x. Know th 4. Run the `./build.sh` script. * Build will default to python 2.7 * To build with python 3.4 or 3.5, run `./build.sh --build-python 3.4` or `./build.sh --build-python 3.5` respectively -5. After a successful build, the `iothub_client.so` Python extension module is copied to the **device/samples** folder. Please follow instructions in [Sample applications](#samplecode) to run the Python samples. +5. After a successful build, the `iothub_client.so` Python extension module is copied to the [**device/samples**][device-samples] and [**service/samples**][service-samples] folders. Visit these folders for instructions on how to run the samples. ###Known build issues: @@ -44,36 +58,31 @@ If you run into this issue, check the **memory consumption** of the device using 2.) CentOS7: Only Python 2.7 is supported due to a missing boost-python3 library package - -## Install the Python iothub_client module on Windows from [PyPI] - -The following instructions outline how you can install the **iothub\_client** module in Windows from [PyPi] using the **iothub\_client** package: - -1. Open a command-prompt window. -2. Install the **iothub\_client** package with the following command: `pip install iothub-client` -3. Now Python is ready to run the sample applications. -Please follow instructions in [Sample applications](#samplecode) to run the Python samples. - -> Note: If it is not already installed, you need to install the [Visual C++ Redistributable for Visual Studio 2015][lnk-c-redist]. - -> Note: If Pip cannot install the package for the specific version of Python installed on your machine, use one of the following options to build the **iothub_client** module. - - -## Build the Python iothub_client module on Windows using Nuget packages (recommended) + +## Build the Python device and service client modules on Windows using Nuget packages (recommended) -The following instructions outline how you can build the libraries in Windows: +### Prerequisite +Because the Azure IoT SDKs for Python are wrappers on top of the [SDKs for C][azure-iot-sdk-c], you will need to compile the C libraries if you want or need to generate the Python libraries from source code. +You will notice that the C SDKs are brought in as submodules to the current repository. +In order to setup your development environment to build the C binaries, you need to follow the instructions [here][c-devbox-setup]: +* On Windows you will need Visual Studio and git +### Compile the Python modules in Visual Studio 1. Open a Visual Studio 2015 x86 Native Tools command prompt and navigate to the folder **build_all/windows** in your local copy of the repository. 2. Run the script `build.cmd` in the **build_all\\windows** directory. 3. As a result, the `iothub_client.pyd` Python extension module is copied to the **device/samples** folder. Follow the instructions in [Sample applications](#samplecode) to run the Python IoT Hub samples. 4. In order to run the samples with a different Python version (e.g. 32bit vs. 64bit or 2.7 vs. 3.4) please rebuild the `iothub_client.pyd` extension. - -## Build the Python iothub_client module on Windows using cmake and boost libraries + +## Build the Python device and service client modules on Windows using cmake and boost libraries -###The following instructions outline how you prepare the boost::python libraries in Windows. -This step is only required once and only necessary for the cmake build: +### Prerequisite +Because the Azure IoT SDKs for Python are wrappers on top of the [SDKs for C][azure-iot-sdk-c], you will need to compile the C libraries if you want or need to generate the Python libraries from source code. +You will notice that the C SDKs are brought in as submodules to the current repository. +In order to setup your development environment to build the C binaries, you need to follow the instructions [here][c-devbox-setup]: +* On Windows you will need Visual Studio, git and cmake +### Compile the Python modules using boost::python libraries in Windows. 1. Open a Visual Studio 2015 x86 or x64 Native Tools command prompt, depending on your installed Python version. 2. Download the zip version of the boost 1.60 library for windows from [boost-zip]. 3. Unpack zip to a local folder, e.g. **C:\boost_1_60_0**. @@ -83,27 +92,31 @@ This step is only required once and only necessary for the cmake build: 7. Run the build command `b2` in the same folder. For x64 builds use the build command `b2 address-model=64`. 8. Set the environment variable **BOOST_ROOT** to the boost folder using the command `SET BOOST_ROOT=C:\boost_1_60_0`. -Now the boost::python library is ready for use. +> Now the boost::python library is ready for use. -Important note: The boost libraries can only be used to build for a single Python version (e.g. V3.4 64bit). In order to build with cmake for another Python version, a clean bootstrap and build of the boost libraries for that version is necessary, or build errors will occur. It is possible to have multiple boost libraries for different Python versions side by side in different roots. Then the **BOOST_ROOT** folder must point to the appropriate boost library at cmake build time. +> Important note: The boost libraries can only be used to build for a single Python version (e.g. V3.4 64bit). In order to build with cmake for another Python version, a clean bootstrap and build of the boost libraries for that version is necessary, or build errors will occur. It is possible to have multiple boost libraries for different Python versions side by side in different roots. Then the **BOOST_ROOT** folder must point to the appropriate boost library at cmake build time. -###The following instructions outline how you can build the Python extension module with cmake in Windows: +9. Open a Visual Studio 2015 x86 Native Tools command prompt and navigate to the folder **build_all/windows** in your local copy of the repository. +10. Verify that `BOOST_ROOT` points to the local boost installation for the right Python version. +11. Run the script `build_client.cmd` in the **build_all\\windows** directory. +12. After a successful build, the `iothub_client.pyd` Python extension module is copied to the **device/samples** folder. Please follow instructions in [Sample applications](#samplecode) to run the Python samples. -1. Open a Visual Studio 2015 x86 Native Tools command prompt and navigate to the folder **build_all/windows** in your local copy of the repository. -2. Verify that `BOOST_ROOT` points to the local boost installation for the right Python version. -3. Run the script `build_client.cmd` in the **build_all\\windows** directory. -4. After a successful build, the `iothub_client.pyd` Python extension module is copied to the **device/samples** folder. Please follow instructions in [Sample applications](#samplecode) to run the Python samples. - -To use the iothub_client extension for native code debugging with [Python Tools for Visual Studio] run the script: `build_client.cmd --config Debug` to get the full debug symbol support. +To use the iothub_client and iothub_service_client extensions for native code debugging with [Python Tools for Visual Studio] run the script: `build_client.cmd --config Debug` to get the full debug symbol support. - + ## Sample applications -This repository contains various Python sample applications that illustrate how to use the Microsoft Azure IoT SDK for Python. To learn how to run a sample application that sends messages to an IoT hub, see [Getting started - running a Python sample application][getstarted]. +This repository contains various Python sample applications that illustrate how to use the Microsoft Azure IoT SDKs for Python. +* [Samples showing how to use the Azure IoT Hub device client][device-samples] +* [Samples showing how to use the Azure IoT Hub service client][service-samples] + [python-2.7 or python-3.5]: https://www.python.org/downloads/ [PyPI]: https://pypi.python.org/pypi/iothub-client/ [Python Tools for Visual Studio]: https://www.visualstudio.com/en-us/features/python-vs.aspx -[getstarted]: python-run-sample.md +[device-samples]: ../device/samples/ +[service-samples]: ../service/samples/ + [boost-zip]: http://www.boost.org/users/history/version_1_60_0.html -[lnk-c-redist]: https://www.microsoft.com/download/details.aspx?id=48145 +[azure-iot-sdk-c]: https://github.com/azure/azure-iot-sdk-c +[c-devbox-setup]: https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/devbox_setup.md \ No newline at end of file diff --git a/doc/python-run-sample.md b/doc/python-run-sample.md deleted file mode 100644 index 55a44446c..000000000 --- a/doc/python-run-sample.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -platform: debian, Linux, raspbian, Ubuntu, windows -device: any -language: Python ---- - -Run a simple Python sample on device -=== ---- - -# Table of Contents - -- [Introduction](#Introduction) -- [Step 1: Prerequisites](#Prerequisites) -- [Step 2: Prepare your Device](#PrepareDevice) -- [Step 3: Run the Sample](#Run) - - -# Introduction - -**About this document** - -This document describes how to run the **iothub_client_sample.py** Python sample application. This multi-step process includes: -- Configuring Azure IoT Hub -- Registering your IoT device -- Build and deploy Azure IoT SDK on device - - -# Step 1: Prerequisites - -You should have the following items ready before beginning the process: -- Computer with Git client installed and access to the - [azure-iot-sdk-python](https://github.com/Azure/azure-iot-sdk-python) GitHub public repository. -- [Prepare your development environment][lnk-python-devbox-setup] -- [Setup your IoT hub and provision devices][lnk-setup-iot-hub] - - -# Step 2: Prepare your Device - -- Make sure desktop is ready as per instructions given on [Prepare your development environment][lnk-python-devbox-setup]. - -> Note: On Windows, you can install the **iothub-client** module package using Pip as described in [Prepare your development environment][lnk-python-devbox-setup]. - - -# Step 3: Run the sample - -- Navigate to the folder **device/samples** in your local copy of the repository. - -- Open the file **iothub_client_sample.py** in a text editor. - -- Locate the following code in the file: - - ``` - connectionString = "[device connection string]" - ``` - -- Replace `[device connection string]` with the connection string for your device. Save the changes. - -- Run the sample application using the following command: - - ``` - python iothub_client_sample.py - ``` - -- The sample application will send messages to your IoT hub. The **iothub-explorer** utility will display the messages as your IoT hub receives them. - -If you receive the error "ImportError: dynamic module does not define module export function (PyInit_iothub_client)" you may be running the samples with a different version of python than the iothub_client was build with. Following the [Prepare your development environment](#python-devbox-setup) to ensure the library is built with the desired python version - -# Experimenting with various transport protocols -There is a command line switch to test each of the AMQP, HTTP and MQTT protocols. It is also possible to simply change the transport in the sample. - - ``` - python iothub_client_sample.py -p - ``` - -# Debugging the samples (and/or your code) -[Visual Studio Code](https://code.visualstudio.com/) provides an excellent environment to write and debug Python code: -- [Python Tools for Visual Studio](https://www.visualstudio.com/en-us/features/python-vs.aspx) - -[lnk-python-devbox-setup]: python-devbox-setup.md -[lnk-setup-iot-hub]: https://aka.ms/howtocreateazureiothub -[lnk-manage-iot-hub]: https://aka.ms/manageiothub diff --git a/readme.md b/readme.md index c77549266..22193b89d 100644 --- a/readme.md +++ b/readme.md @@ -1,17 +1,16 @@ -# Microsoft Azure IoT SDK for Python +# Microsoft Azure IoT SDKs for Python This repository contains the following: -* **Azure IoT Hub Device SDK**: to connect client devices to Azure IoT Hub +* **Azure IoT Hub Device SDK for Python**: to connect client devices to Azure IoT Hub +* **Azure IoT Hub Service SDK for Python**: enables developing back-end applications for Azure IoT To find SDKs in other languages for Azure IoT, please refer to the [azure-iot-sdks][azure-iot-sdks] repository. ## Developing applications for Azure IoT - Visit [Azure IoT Dev Center][iot-dev-center] to learn more about developing applications for Azure IoT. ## How to clone the repository - The repository is using [GitHub Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) for its dependencies. In order to automatically clone these submodules, you need to use the --recursive option as described here: ``` @@ -25,27 +24,18 @@ git submodule update --init --recursive ## How to use the Azure IoT SDKs for Python Devices and data sources in an IoT solution can range from a simple network-connected sensor to a powerful, standalone computing device. Devices may have limited processing capability, memory, communication bandwidth, and communication protocol support. The IoT device SDKs enable you to implement client applications for a wide variety of devices. - * **Using PyPI package on Windows (coming soon for Linux)**: the simplest way to use the Azure IoT SDK for Python to develop device apps on Windows is to leverage the PyPI package which you can install following these [instructions][PyPI-install-instructions] -* **Building the library and working with the SDK code**: follow [these instructions][devbox-setup]. - +* **Building the libraries and working with the SDK code**: follow [these instructions][devbox-setup]. ## Samples - -Whithin the repository, you can find various types of simple samples that can help you get started. -And if you are looking for end to end samples that show how to do simple analytics and processing of the data generated by your device using Azure services such as Stream Analytics, Big Data, Machine Learning and others, check out our [E2E samples gallery](http://aka.ms/azureiotsamples). -To run the samples, you can follow [these instructions][run-samples] - -* [Simple Sample](device/samples/iothub_client_sample.py): shows how to connect to IoT Hub and send and receive messages using the AMQP, MQTT or HTTP protocol. -* [Class Sample using AMQP](device/samples/iothub_client_sample_class.py): shows how to connect to IoT Hub with a HubManager class to send and receive messages using the AMQP protocol. -* [Simple Sample X-509](device/samples/iothub_client_sample_x509.py): shows how to authenticate a device using X-509 certs and send and receive messages. +This repository contains various Python sample applications that illustrate how to use the Microsoft Azure IoT SDKs for Python. +* [Samples showing how to use the Azure IoT Hub device client][device-samples] +* [Samples showing how to use the Azure IoT Hub service client][service-samples] ## Contribution, feedback and issues - If you encounter any bugs, have suggestions for new features or if you would like to become an active contributor to this project please follow the instructions provided in the [contribution guidelines](CONTRIBUTING.md). ## Support - If you are having issues using one of the packages or using the Azure IoT Hub service that go beyond simple bug fixes or help requests that would be dealt within the [issues section](https://github.com/Azure/azure-iot-sdks/issues) of this project, the Microsoft Customer Support team will try and help out on a best effort basis. To engage Microsoft support, you can create a support ticket directly from the [Azure portal](https://ms.portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade). Escalated support requests for Azure IoT Hub SDKs development questions will only be available Monday thru Friday during normal coverage hours of 6 a.m. to 6 p.m. PST. @@ -56,10 +46,7 @@ Here is what you can expect Microsoft Support to be able to help with: * **REST/API Issues**: Using the IoT Hub REST/APIs that are documented in the [documentation]( https://msdn.microsoft.com/library/mt548492.aspx). ## Read more - * [Azure IoT Hub documentation][iot-hub-documentation] -* [Python run sample][run-samples] describes how to run a simple Python sample for Azure IoT Hub. -* [FAQ](doc/faq.md) contains frequently asked questions about the SDKs and libraries. --- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. @@ -69,4 +56,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [azure-iot-sdks]: http://github.com/azure/azure-iot-sdks [PyPI-install-instructions]: doc/python-devbox-setup.md#windows-wheels [devbox-setup]: doc/python-devbox-setup.md -[run-samples]: doc/python-run-sample.md +[device-samples]: device/samples/ +[service-samples]: service/samples/ \ No newline at end of file diff --git a/service/readme.md b/service/readme.md index e2bbea1bc..8ade835ae 100644 --- a/service/readme.md +++ b/service/readme.md @@ -5,15 +5,16 @@ Build service clients that communicate with Azure IoT Hub. ## Features Use the service SDK to: -* Managing the device identity registry (CRUD operations for devices). -* Sending messages to devices (C2D messages) +* Manage the device identity registry (CRUD operations for devices). +* Send messages to devices (C2D messages) +* interact with Device Twins and Invoke Device Direct Methods -## Application development guides -For more information on how to use this library refer to the documents below: -- [Prepare your Python development environment](../doc/get_started/python-devbox-setup.md) -- [Setup IoT Hub](../doc/setup_iothub.md) -- [Provision devices](../doc/manage_iot_hub.md) -- [Run a Python sample application](../doc/get_started/python-run-sample.md) +## How to use the Azure IoT device SDK for Python + +* [Check out the simple samples provided in this repository][samples] + +## Samples +Whithin the repository, you can find various types of [simple samples][samples] that can help you get started. ## Directory structure @@ -30,3 +31,5 @@ C Source of the Python extension module. This module wraps the IoT Hub C Service ### /tests Python C extension module unit tests. The unit tests exercise a mocked Python extension module to test the Python interface. + +[samples]: samples/ diff --git a/service/samples/readme.md b/service/samples/readme.md new file mode 100644 index 000000000..0f0d92a78 --- /dev/null +++ b/service/samples/readme.md @@ -0,0 +1,27 @@ +# Samples for the Azure IoT service SDK for Python +This folder contains simple samples showing how to use the various features of the Microsoft Azure IoT Hub service from a back-end application running Python. + +## List of samples +* [Device Registry manager operations sample](./iothub_registrymanager_sample.py): shows how to use the IoT Hub device Registry (create, update, delete devices...) +* [C2D Messaging sample](iothub_messaging_sample.py): shows how to send Cloud to Device Messages +* [Device Twins sample](iothub_devicetwin_sample.py): shows how to work with Device Twins from a back-end application +* [Device Method sample](iothub_devicemethod_sample.py): shows how to invoke a direct device Method from a back-end application + +And if you are looking for end to end samples that show how to do simple analytics and processing of the data generated by your device using Azure services such as Stream Analytics, Big Data, Machine Learning and others, check out our [E2E samples gallery](http://aka.ms/azureiotsamples). + +## How to run the samples +In order to run the service samples you will first need the following prerequisites: +* [Setup your development environment][devbox-setup] +> Note: On Windows, it is recommended to install the **iothub-service-client** module package using pip (see link above). +* [Create an Azure IoT Hub instance][lnk-setup-iot-hub] +* Get the sample files: + * if you have cloned the repository, Navigate to the folder **service/samples** + * if you are using the iothub_service_client module installed with pip, download the samples folder content to your target. +* To learn more about the command line options to be passed for each of the samples, type the following command (replacing `sample_file.py` with the sample file of your choice): + ``` + python sample_file.py -h + ``` + +[lnk-setup-iot-hub]: https://aka.ms/howtocreateazureiothub +[lnk-manage-iot-hub]: https://aka.ms/manageiothub +[devbox-setup]: ../../doc/python-devbox-setup.md \ No newline at end of file diff --git a/service/thirdpartynotice.txt b/service/thirdpartynotice.txt deleted file mode 100644 index 78d351a9e..000000000 --- a/service/thirdpartynotice.txt +++ /dev/null @@ -1,35 +0,0 @@ -Third Party Notices for Azure IoT SDKs project - -This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). -Microsoft Corporation is not the original author of the Third Party Code. -The original copyright notice and license, under which Microsoft Corporation received such Third Party Code, -are set out below. This Third Party Code is licensed to you under their original license terms set forth below. -Microsoft Corporation reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. - -1. Boost v. 1.60, obtained from http://www.boost.org -/* -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - diff --git a/thirdpartynotice.txt b/thirdpartynotice.txt index 487809d38..78d351a9e 100644 --- a/thirdpartynotice.txt +++ b/thirdpartynotice.txt @@ -1,4 +1,3 @@ - Third Party Notices for Azure IoT SDKs project This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). @@ -7,1010 +6,30 @@ The original copyright notice and license, under which Microsoft Corporation rec are set out below. This Third Party Code is licensed to you under their original license terms set forth below. Microsoft Corporation reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. - Paho Java v1.0.2, obtained from https://github.com/eclipse/paho.mqtt.java +1. Boost v. 1.60, obtained from http://www.boost.org +/* +Boost Software License - Version 1.0 - August 17th, 2003 -/* -Eclipse Public License - v 1.0 +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE - PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR - DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS - AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial - code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program - originate from and are distributed by that particular Contributor. A - Contribution 'originates' from a Contributor if it was added to the - Program by such Contributor itself or anyone acting on such - Contributor's behalf. Contributions do not include additions to the - Program which: (i) are separate modules of software distributed in - conjunction with the Program under their own license agreement, and (ii) - are not derivative works of the Program. - -"Contributor" means any person or entity that distributes - the Program. - -"Licensed Patents" mean patent claims licensable by a - Contributor which are necessarily infringed by the use or sale of its - Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance - with this Agreement. - -"Recipient" means anyone who receives the Program under - this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each - Contributor hereby grants Recipient a non-exclusive, worldwide, - royalty-free copyright license to reproduce, prepare derivative works - of, publicly display, publicly perform, distribute and sublicense the - Contribution of such Contributor, if any, and such derivative works, in - source code and object code form. - -b) Subject to the terms of this Agreement, each - Contributor hereby grants Recipient a non-exclusive, worldwide, - royalty-free patent license under Licensed Patents to make, use, sell, - offer to sell, import and otherwise transfer the Contribution of such - Contributor, if any, in source code and object code form. This patent - license shall apply to the combination of the Contribution and the - Program if, at the time the Contribution is added by the Contributor, - such addition of the Contribution causes such combination to be covered - by the Licensed Patents. The patent license shall not apply to any other - combinations which include the Contribution. No hardware per se is - licensed hereunder. - -c) Recipient understands that although each Contributor - grants the licenses to its Contributions set forth herein, no assurances - are provided by any Contributor that the Program does not infringe the - patent or other intellectual property rights of any other entity. Each - Contributor disclaims any liability to Recipient for claims brought by - any other entity based on infringement of intellectual property rights - or otherwise. As a condition to exercising the rights and licenses - granted hereunder, each Recipient hereby assumes sole responsibility to - secure any other intellectual property rights needed, if any. For - example, if a third party patent license is required to allow Recipient - to distribute the Program, it is Recipient's responsibility to acquire - that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it - has sufficient copyright rights in its Contribution, if any, to grant - the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code - form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this - Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors - all warranties and conditions, express and implied, including warranties - or conditions of title and non-infringement, and implied warranties or - conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors - all liability for damages, including direct, indirect, special, - incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this - Agreement are offered by that Contributor alone and not by any other - party; and - -iv) states that source code for the Program is available - from such Contributor, and informs licensees how to obtain it in a - reasonable manner on or through a medium customarily used for software - exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each - copy of the Program. - -Contributors may not remove or alter any copyright notices contained - within the Program. - -Each Contributor must identify itself as the originator of its - Contribution, if any, in a manner that reasonably allows subsequent - Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain - responsibilities with respect to end users, business partners and the - like. While this license is intended to facilitate the commercial use of - the Program, the Contributor who includes the Program in a commercial - product offering should do so in a manner which does not create - potential liability for other Contributors. Therefore, if a Contributor - includes the Program in a commercial product offering, such Contributor - ("Commercial Contributor") hereby agrees to defend and - indemnify every other Contributor ("Indemnified Contributor") - against any losses, damages and costs (collectively "Losses") - arising from claims, lawsuits and other legal actions brought by a third - party against the Indemnified Contributor to the extent caused by the - acts or omissions of such Commercial Contributor in connection with its - distribution of the Program in a commercial product offering. The - obligations in this section do not apply to any claims or Losses - relating to any actual or alleged intellectual property infringement. In - order to qualify, an Indemnified Contributor must: a) promptly notify - the Commercial Contributor in writing of such claim, and b) allow the - Commercial Contributor to control, and cooperate with the Commercial - Contributor in, the defense and any related settlement negotiations. The - Indemnified Contributor may participate in any such claim at its own - expense. - -For example, a Contributor might include the Program in a commercial - product offering, Product X. That Contributor is then a Commercial - Contributor. If that Commercial Contributor then makes performance - claims, or offers warranties related to Product X, those performance - claims and warranties are such Commercial Contributor's responsibility - alone. Under this section, the Commercial Contributor would have to - defend claims against the other Contributors related to those - performance claims and warranties, and if a court requires any other - Contributor to pay any damages as a result, the Commercial Contributor - must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS - PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, - ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY - OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely - responsible for determining the appropriateness of using and - distributing the Program and assumes all risks associated with its - exercise of rights under this Agreement , including but not limited to - the risks and costs of program errors, compliance with applicable laws, - damage to or loss of data, programs or equipment, and unavailability or - interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT - NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING - WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR - DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED - HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under - applicable law, it shall not affect the validity or enforceability of - the remainder of the terms of this Agreement, and without further action - by the parties hereto, such provision shall be reformed to the minimum - extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity - (including a cross-claim or counterclaim in a lawsuit) alleging that the - Program itself (excluding combinations of the Program with other - software or hardware) infringes such Recipient's patent(s), then such - Recipient's rights granted under Section 2(b) shall terminate as of the - date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it - fails to comply with any of the material terms or conditions of this - Agreement and does not cure such failure in a reasonable period of time - after becoming aware of such noncompliance. If all Recipient's rights - under this Agreement terminate, Recipient agrees to cease use and - distribution of the Program as soon as reasonably practicable. However, - Recipient's obligations under this Agreement and any licenses granted by - Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this - Agreement, but in order to avoid inconsistency the Agreement is - copyrighted and may only be modified in the following manner. The - Agreement Steward reserves the right to publish new versions (including - revisions) of this Agreement from time to time. No one other than the - Agreement Steward has the right to modify this Agreement. The Eclipse - Foundation is the initial Agreement Steward. The Eclipse Foundation may - assign the responsibility to serve as the Agreement Steward to a - suitable separate entity. Each new version of the Agreement will be - given a distinguishing version number. The Program (including - Contributions) may always be distributed subject to the version of the - Agreement under which it was received. In addition, after a new version - of the Agreement is published, Contributor may elect to distribute the - Program (including its Contributions) under the new version. Except as - expressly stated in Sections 2(a) and 2(b) above, Recipient receives no - rights or licenses to the intellectual property of any Contributor under - this Agreement, whether expressly, by implication, estoppel or - otherwise. All rights in the Program not expressly granted under this - Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and - the intellectual property laws of the United States of America. No party - to this Agreement will bring a legal action under this Agreement more - than one year after the cause of action arose. Each party waives its - rights to a jury trial in any resulting litigation. - -*/ - - Apache Qpid Proton, obtained from https://github.com/apache/qpid-proton -/* - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - -*/ - - Json.NET v6.0.8, obtained from https://www.nuget.org/packages/Newtonsoft.Json - /* - The MIT License (MIT) - -Copyright (c) 2007 James Newton-King - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - Json.NET v7.0.1, obtained from https://www.nuget.org/packages/Newtonsoft.Json - /* - The MIT License (MIT) - -Copyright (c) 2007 James Newton-King - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - OpenSSL, obtained from https://github.com/openssl/openssl.git - - LICENSE ISSUES - ============== - - The OpenSSL toolkit stays under a dual license, i.e. both the conditions of - the OpenSSL License and the original SSLeay license apply to the toolkit. - See below for the actual license texts. Actually both licenses are BSD-style - Open Source licenses. In case of any license issues related to OpenSSL - please contact openssl-core@openssl.org. - - OpenSSL License - --------------- - -/* ==================================================================== - * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - - Original SSLeay License - ----------------------- - -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - - OWIN 1.0, obtained from https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt - /* - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. */ - - Google gson version 2.5, obtained from https://github.com/google/gson -/* - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ \ No newline at end of file