async def put(url: str, log_404=True, json=None, data=None, **kwargs: Any) -> Optional[ClientResponse]: if HTTP_PREFIX is None: raise OpenhabConnectionNotSetUpError() if IS_READ_ONLY or not IS_ONLINE: return None assert not url.startswith('/'), url url = f'{HTTP_PREFIX}/rest/{url}/' mgr = _RequestContextManager( HTTP_SESSION._request(METH_PUT, url, allow_redirects=HTTP_ALLOW_REDIRECTS, data=data, json=json, **kwargs)) if data is None: data = json return await check_response(mgr, log_404=log_404, sent_data=data)
async def get(url: str, log_404=True, **kwargs: Any) -> ClientResponse: if HTTP_PREFIX is None: raise OpenhabConnectionNotSetUpError() assert not url.startswith('/'), url url = f'{HTTP_PREFIX}/rest/{url}/' mgr = _RequestContextManager( HTTP_SESSION._request(METH_GET, url, allow_redirects=HTTP_ALLOW_REDIRECTS, **kwargs)) return await check_response(mgr, log_404=log_404)