示例#1
0
    def device_tags(self, **params):
        """ Method for `List Device Tags <https://m2x.att.com/developer/documentation/v2/device#List-Device-Tags>`_ endpoint.

        :param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.

        :return: Device tags associated with your account
        :rtype: dict

        :raises: :class:`~requests.exceptions.HTTPError` if an error occurs when sending the HTTP request
        """
        return Device.by_tags(self, **params)
示例#2
0
    def create_device(self, **params):
        """ Method for `Create Device <https://m2x.att.com/developer/documentation/v2/device#Create-Device>`_ endpoint.

        :param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.

        :return: The newly created Device
        :rtype: Device

        :raises: :class:`~requests.exceptions.HTTPError` if an error occurs when sending the HTTP request
        """
        return Device.create(self, **params)
示例#3
0
    def device_catalog(self, **params):
        """ Method for `List Public Devices Catalog <https://m2x.att.com/developer/documentation/v2/device#List-Public-Devices-Catalog>`_ endpoint.

        :param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.

        :return: List of :class:`.Device` objects
        :rtype: `list <https://docs.python.org/2/library/functions.html#list>`_

        :raises: :class:`~requests.exceptions.HTTPError` if an error occurs when sending the HTTP request
        """
        return Device.catalog(self, **params)
示例#4
0
    def device(self, id):
        """ Method for `View Device Details <https://m2x.att.com/developer/documentation/v2/device#View-Device-Details>`_ endpoint.

        :param id: ID of the Device to retrieve
        :type id: str

        :return: The matching Device
        :rtype: Device

        :raises: :class:`~requests.exceptions.HTTPError` if an error occurs when sending the HTTP request
        """
        return Device.get(self, id)
示例#5
0
 def device_catalog(self, **params):
     return Device.catalog(self, **params)
示例#6
0
 def test_by_tags(self, **kwargs):
     out = Device.by_tags(self.client.api)
     assert out['foo'] == 1
     assert out['bar'] == 1
示例#7
0
 def device(self, id):
     return Device.get(self, id)
示例#8
0
 def test_by_tags(self, **kwargs):
     out = Device.by_tags(self.client.api)
     assert out['foo'] == 1
     assert out['bar'] == 1
示例#9
0
 def test_catalog(self, **kwargs):
     out = Device.catalog(self.client.api)
     assert len(out) == 2
示例#10
0
#!/usr/bin/env python

# Usage:
#   $ API_KEY=<YOUR MASTER API KEY> python example.py

import os

from m2x.client import M2XClient
from m2x.v2.devices import Device

client = M2XClient(key=os.environ['API_KEY'])

params = {
    "visibility": "private",
    "status": "enabled",
    "limit": "3"
}

# Use data=... to send also a JSON body in the request
response = Device.search(api=client, data=params)

if len(response) > 0:
    print("Devices Details:\n")
    for device in response:
        print("          Name: {device.name}".format(device=device))
        print("            Id: {device.id}".format(device=device))
        print("    Visibility: {device.visibility}".format(device=device))
        print("        Status: {device.status}\n".format(device=device))
else:
    print("Devices not available in this search criteria")
示例#11
0
 def test_catalog(self, **kwargs):
     out = Device.catalog(self.client.api)
     assert len(out) == 2
#!/usr/bin/env python

# Usage:
#   $ API_KEY=<YOUR MASTER API KEY> python example.py

import os

from m2x.client import M2XClient
from m2x.v2.devices import Device

client = M2XClient(key=os.environ['API_KEY'])

params = {"visibility": "private", "status": "enabled", "limit": "3"}

# Use data=... to send also a JSON body in the request
response = Device.search(api=client, data=params)

if len(response) > 0:
    print("Devices Details:\n")
    for device in response:
        print("          Name: {device.name}".format(device=device))
        print("            Id: {device.id}".format(device=device))
        print("    Visibility: {device.visibility}".format(device=device))
        print("        Status: {device.status}\n".format(device=device))
else:
    print("Devices not available in this search criteria")
示例#13
0
#!/usr/bin/env python

# Usage:
#   $ API_KEY=<YOUR MASTER API KEY> python example.py

import os

from m2x.client import M2XClient
from m2x.v2.devices import Device

client = M2XClient(key=os.environ['API_KEY'])

params = {"visibility": "private", "status": "enabled", "limit": "3"}

response = Device.search(api=client, params=params)
if len(response) > 0:
    print("\nDevice Details :")
    for device in response:
        print(
            "Device name: %s Device Id: %s Device Visibility: %s Device Status: %s "
            % (device.name, device.id, device.visibility, device.status))
else:
    print("Devices not available in this search criteria")
示例#14
0
 def devices(self, **params):
     return Device.list(self, **params)
示例#15
0
 def create_device(self, **params):
     return Device.create(self, **params)
示例#16
0
 def create_device(self, **params):
     return Device.create(self, **params)
示例#17
0
 def device(self, id):
     return Device.get(self, id)
示例#18
0
 def device_tags(self, **params):
     return Device.by_tags(self, **params)
示例#19
0
 def device_catalog(self, **params):
     return Device.catalog(self, **params)
示例#20
0
 def devices(self, **params):
     return Device.list(self, **params)
示例#21
0
 def device_tags(self, **params):
     return Device.by_tags(self, **params)
示例#22
0
 def devices_search(self, **params):
     return Device.search(self, **params)