示例#1
0
 def test_list_alerts(self):
     iot = self.login()
     acct = iotkitclient.Account(iot)
     acct.get_account(newaccount)
     js = acct.list_alerts()
     iotkitclient.prettyprint(js)
     self.assertEqual(0, len(js))
示例#2
0
 def setUpClass(cls):
     global iot, acct
     iot = iotkitclient.Client(host=hostname, proxies=proxies)
     iot.login(username, password)
     acct = iotkitclient.Account(iot)
     cls.deleteAll(newaccount)
     acct.create(newaccount)
     iot.reinit(username, password)
示例#3
0
 def setUpClass(cls):
     global iot, acct
     iot = iotkitclient.Client(host=hostname, proxies=proxies)
     iot.login(username, password)
     acct = iotkitclient.Account(iot)
     acct.get_account(account_name)
     while True:
         try:
             device = iotkitclient.Device(acct, deviceid)
             print "Deleting ", deviceid
             device.delete()
         except:
             break
示例#4
0
# 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.

import iotkitclient
import config
import time

# Connect to IoT Analytics site and authenticate
print "Connecting to %s ..." % config.hostname
iot = iotkitclient.Connect(host=config.hostname, proxies=config.proxies)
iot.login(config.username, config.password)
print "Connected. User ID: %s ..." % iot.user_id

# Link to a specific IoT Analytics account
acct = iotkitclient.Account(iot)
try:
    acct.get_account(config.account_name)
except:
    acct.create_account(config.account_name)
    iot.reinit(config.username, config.password)
print "Using Account: %s ..." % config.account_name

# Link to a specific device in the account
device = iotkitclient.Device(acct)
device_id = iot.user_id + "_01"
try:
    device.get_device(device_id)
except:
    device_info = {
        "deviceId": device_id,
示例#5
0
 def test_get(self):
     acct2 = iotkitclient.Account(iot)
     acct2.get_account(newaccount)
     self.assertEqual(acct.id, acct2.id)
示例#6
0
 def get(self, name):
     acct = iotkitclient.Account(iot)
     id = acct.get_account(name)
     return acct