REST API: via Python to get the ETag and use it to update a host?

Hello Michael

Thanks for your knowledge.

I got this problem in my env.:

./api_host_update_test.py
Traceback (most recent call last):
  File "./api_host_update_test.py", line 54, in <module>
    response_2 = urllib.request.urlopen(request_2)
  File "/omd/sites/WWIPU01/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/omd/sites/WWIPU01/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/omd/sites/WWIPU01/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/omd/sites/WWIPU01/lib/python3.8/urllib/request.py", line 563, in error
    result = self._call_chain(*args)
  File "/omd/sites/WWIPU01/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/omd/sites/WWIPU01/lib/python3.8/urllib/request.py", line 734, in http_error_302
    new = self.redirect_request(req, fp, code, msg, headers, newurl)
  File "/omd/sites/WWIPU01/lib/python3.8/urllib/request.py", line 672, in redirect_request
    raise HTTPError(req.full_url, code, msg, headers, fp)
urllib.error.HTTPError: HTTP Error 302: Found

by using this code:

Do you’ve any solution?
I’m just beginning with Python sorry.
Thanks for your help!