Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #5
0
 def device_catalog(self, **params):
     return Device.catalog(self, **params)
Exemple #6
0
 def test_by_tags(self, **kwargs):
     out = Device.by_tags(self.client.api)
     assert out['foo'] == 1
     assert out['bar'] == 1
Exemple #7
0
 def device(self, id):
     return Device.get(self, id)
Exemple #8
0
 def test_by_tags(self, **kwargs):
     out = Device.by_tags(self.client.api)
     assert out['foo'] == 1
     assert out['bar'] == 1
Exemple #9
0
 def test_catalog(self, **kwargs):
     out = Device.catalog(self.client.api)
     assert len(out) == 2
Exemple #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")
Exemple #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")
#!/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")
Exemple #14
0
 def devices(self, **params):
     return Device.list(self, **params)
Exemple #15
0
 def create_device(self, **params):
     return Device.create(self, **params)
Exemple #16
0
 def create_device(self, **params):
     return Device.create(self, **params)
Exemple #17
0
 def device(self, id):
     return Device.get(self, id)
Exemple #18
0
 def device_tags(self, **params):
     return Device.by_tags(self, **params)
Exemple #19
0
 def device_catalog(self, **params):
     return Device.catalog(self, **params)
Exemple #20
0
 def devices(self, **params):
     return Device.list(self, **params)
Exemple #21
0
 def device_tags(self, **params):
     return Device.by_tags(self, **params)
Exemple #22
0
 def devices_search(self, **params):
     return Device.search(self, **params)