コード例 #1
0
 def _get_config(self):
     res = open_auklet_url(
         build_url(self.base_url,
                   "private/devices/{}/app_config/".format(self.app_id)),
         self.apikey)
     if res is not None:
         return json.loads(u(res.read()))['config']
コード例 #2
0
 def _get_conf(self):
     res = open_auklet_url(
         build_url(self.client.base_url, "private/devices/config/"),
         self.client.apikey)
     loaded = json.loads(u(res.read()))
     self._write_conf(loaded)
     self._read_from_conf(loaded)
コード例 #3
0
 def check_device(self, device_id):
     try:
         opened = open_auklet_url(
             build_url(self.base_url,
                       "private/devices/{}/".format(device_id)),
             self.apikey)
         res = json.loads(u(opened.read()))
         created = False
     except HTTPError:
         res = self.create_device()
         created = True
     return res, created