Lines Matching full:path

57     def get(self, path: str):
62 resp = self._s.get(f'{self.api_url}{path}', params=params, timeout=self.timeout)
65 …def put_raw(self, path: str, data: str | dict | None = None, headers: dict | None = None, params: …
67 …resp = self._s.put(f'{self.api_url}{path}', data=data, headers=headers, params=params, timeout=sel…
70 def put(self, path: str, data: str | dict, uri_options: str = ''):
74 …return self.put_raw(f'{path}?timeout={self.timeout}&format={self.format}' + uri_options, data=data…
76 def post(self, path: str, data: str | dict | None = None):
86 …resp = self._s.post(f'{self.api_url}{path}' + uri_options, data=data, headers=headers, timeout=sel…
89 def delete_raw(self, path: str):
91 resp = self._s.delete(f'{self.api_url}{path}', timeout=self.timeout)
94 def delete(self, endpoint: str, path: str):
96 return self.delete_raw(f'/clients/{endpoint}/{path}')
98 def execute(self, endpoint: str, path: str):
100 return self.post(f'/clients/{endpoint}/{path}')
102 def write(self, endpoint: str, path: str, value: bool | int | str):
104 if len(path.split('/')) == 3:
108 rid = path.split('/')[-1]
109 return self.put(f'/clients/{endpoint}/{path}', self._define_resource(rid, value, kind))
111 def write_attributes(self, endpoint: str, path: str, attributes: dict):
112 """Send LwM2M Write-Attributes to given path
116 return self.put_raw(f'/clients/{endpoint}/{path}/attributes', params=attributes)
118 def remove_attributes(self, endpoint: str, path: str, attributes: list):
119 """Send LwM2M Write-Attributes to given path
124 return self.put_raw(f'/clients/{endpoint}/{path}/attributes?'+ attrs)
126 def update_obj_instance(self, endpoint: str, path: str, resources: dict):
128 data = self._define_obj_inst(path, resources)
129 return self.put(f'/clients/{endpoint}/{path}', data, uri_options='&replace=false')
131 def replace_obj_instance(self, endpoint: str, path: str, resources: dict):
133 data = self._define_obj_inst(path, resources)
134 return self.put(f'/clients/{endpoint}/{path}', data, uri_options='&replace=true')
136 def create_obj_instance(self, endpoint: str, path: str, resources: dict):
138 data = self._define_obj_inst(path, resources)
139 path = '/'.join(path.split('/')[:-1]) # Create call should not have instance ID in path
140 return self.post(f'/clients/{endpoint}/{path}', data)
174 def _define_obj_inst(cls, path: str, resources: dict):
178 "id": int(path.split('/')[-1]), # ID is last element of path
253 def read(self, endpoint: str, path: str):
255 resp = self.get(f'/clients/{endpoint}/{path}')
277 for path, content in payload.items():
278 if path == "/":
282 keys = [int(key) for key in path.lstrip("/").split('/')]
304 raise RuntimeError(f'Unhandled path {path}')
315 paths = [path if path.startswith('/') else '/' + path for path in paths]
347 for path, value in resources.items():
348 path = path if path.startswith('/') else '/' + path
349 level = len(path.split('/')) - 1
350 rid = int(path.split('/')[-1])
359 raise RuntimeError(f'Unhandled path {path}')
360 data[path] = value
365 def discover(self, endpoint: str, path: str):
366 …resp = self.handle_response(self._s.get(f'{self.api_url}/clients/{endpoint}/{path}/discover', time…
392 def observe(self, endpoint: str, path: str):
393 return self.post(f'/clients/{endpoint}/{path}/observe', data="")
395 def cancel_observe(self, endpoint: str, path: str):
396 return self.delete_raw(f'/clients/{endpoint}/{path}/observe?active')
398 def passive_cancel_observe(self, endpoint: str, path: str):
399 return self.delete_raw(f'/clients/{endpoint}/{path}/observe')
408 paths = [path if path.startswith('/') else '/' + path for path in paths]
412 paths = [path if path.startswith('/') else '/' + path for path in paths]