async def main(): client = Client( token= "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOiJmODFhODQ3Zi1mZDAyLTQzMDgtOWY3Zi02MTNkZjQ2OTUyNzMiLCJ0b2tlbklkIjoiZjdiZDA1NzMtZTYzMC00ZGIxLTllMTItODE2MDA5NTgyODU4IiwiYWNjZXNzTGV2ZWwiOiJERVZJQ0UiLCJ0b2tlblR5cGUiOiJQRVJNQU5FTlQifQ.VuPRvdMayBg7GxixT4QBjXd3jYO_3Q24Fctx508_p5iRxY96zv0z9-UXQsYGJiJjsI3E7ei2gtgEF84gsm8bnA" ) await asyncio.gather(monitor_humidity(client), monitor_temperature(client), keepOnline(client))
async def main(): client = Client( asyncio=True, token= "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOiJmMTAyZGVhYy0wZGQyLTQwZWQtOTM4NS1lMzI3YjM0M2Y2ZmUiLCJ0b2tlbklkIjoiYWRjMjg4MzgtOGUyMi00OWYyLWI1ZDktYWI4M2Y0M2ZkN2RkIiwiYWNjZXNzTGV2ZWwiOiJERVZJQ0UiLCJ0b2tlblR5cGUiOiJQRVJNQU5FTlQifQ.f7GWid4sS8GhQB_qb9PQlI98ULp3HC3-63Ja97vuLYcFCzg9vKF-P5b1GBCgh1t_2GD3qa2p_UeIF5y6Ues65g" ) async for data in client.subscription_root.deviceUpdated(): print(data)
async def main(): client = Client( asyncio=True, token= "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOiJmODFhODQ3Zi1mZDAyLTQzMDgtOWY3Zi02MTNkZjQ2OTUyNzMiLCJ0b2tlbklkIjoiZjdiZDA1NzMtZTYzMC00ZGIxLTllMTItODE2MDA5NTgyODU4IiwiYWNjZXNzTGV2ZWwiOiJERVZJQ0UiLCJ0b2tlblR5cGUiOiJQRVJNQU5FTlQifQ.VuPRvdMayBg7GxixT4QBjXd3jYO_3Q24Fctx508_p5iRxY96zv0z9-UXQsYGJiJjsI3E7ei2gtgEF84gsm8bnA" ) async for node in client.subscription_root.floatSeriesNodeCreated( seriesId="15dcf4e4-e7de-4c0e-a944-a1e63fbebb3d"): print(node.value)
class TestIgloo(object): def setup(self): self.client = Client(URL) def test_sftp_connection(self): with self.client.get_sftp_client() as sftp: pass def test_list(self): client = Client(URL) eq_(client.list(write=False), [])
from igloo import Client, Device client = Client( token= "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOiJlNzYxZmZlMi1lM2Q5LTQ0YjYtYjYyZC00M2Y4ZTljMTRjNjIiLCJ0b2tlbklkIjoiMGQxNTcxNGEtM2UyZS00NjFhLTg2ZTMtOGQwZWUwMTY4NWEzIiwiYWNjZXNzTGV2ZWwiOiJERVZJQ0UiLCJ0b2tlblR5cGUiOiJQRVJNQU5FTlQifQ.ttiW6TVvcKoWmhDSL8fTqq_ItWvPa_41zolI4gRi2zwKlUVV-PWRMk3QM1ZcAuEuOtGGLaPuilR-4Z6JZf13ag" ) thermometer = Device(client, "229718d6-e4fe-43dd-a2e6-6504a2e9a5f9") print(thermometer.online)
import asyncio import igloo from igloo import User, Client client = Client( token= "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOiI0ZDY3MWRkZS0wMjE3LTRlMTYtODQ0MC01MDNkOTcyNTJjYjAiLCJ0b2tlbklkIjoiYjYxNjhhN2QtOTU2YS00N2FhLWJhZTctNGI1MTE1YzE4MDU3IiwiYWNjZXNzTGV2ZWwiOiJERVZJQ0UiLCJ0b2tlblR5cGUiOiJQRVJNQU5FTlQifQ.MCp0qmm0UkwOiNWx2JWXYxhmQ4dOzl3DLiAeIhaGxa9YPNC6MV9jhP0ETcGD_WhEnAldMo-8Qwt0p_UmYl2wdQ" ) user = User(client) print(user.environments[0].name)
def test_list(self): client = Client(URL) eq_(client.list(write=False), [])
def setup(self): self.client = Client(URL)
def test_connection_with_invalid_url(): client = Client('Foo@bar') with client.get_sftp_client() as sftp: pass
def test_profile_client(): client = Client.from_profile('default')
def test_client(): client = Client(URL)
from igloo import Client, User import asyncio client = Client(asyncio=True, token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE1NTQ0OTcyNjksInVzZXJJZCI6ImU3NjFmZmUyLWUzZDktNDRiNi1iNjJkLTQzZjhlOWMxNGM2MiIsImFjY2Vzc0xldmVsIjoiT1dORVIiLCJ0b2tlblR5cGUiOiJURU1QT1JBUlkifQ.gZFA4bxGLNwiAs5ZoyUlZ4lgItBNUrxOuKhToC5bMR_W5xDym7Hbj1lfUv_RQHe2-IHDUL7n-xHdVkeVdA4PmA") async def main(): user = User(client) name = user.name email = user.email print(await name) print(await email) loop = asyncio.get_event_loop() loop.run_until_complete(main())
def test_missing_profile_client(): client = Client.from_profile('some_missing_profile')