Request info is not included in ApiException
Created by: redixin
When API error returned, it sometimes hard to figure out what exactly was requested, because only http response details are included:
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': '9954faf3-7258-4619-b6b4-c3ac0b55a340', 'Cache-Control': 'no-cache, private', 'Content-Type': 'text/plain; charset=utf-8', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': 'cee19ddf-4747-45cb-93a7-e774fe2a061e', 'X-Kubernetes-Pf-Prioritylevel-Uid': '1d97a02a-9039-4fde-bf2e-1e9779e51408', 'Date': 'Thu, 04 Aug 2022 10:14:55 GMT', 'Content-Length': '19'})
HTTP response body: b'404 page not found\n'
Knowing http request details may be helpful. Something like this:
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': '9954faf3-7258-4619-b6b4-c3ac0b55a340', 'Cache-Control': 'no-cache, private', 'Content-Type': 'text/plain; charset=utf-8', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': 'cee19ddf-4747-45cb-93a7-e774fe2a061e', 'X-Kubernetes-Pf-Prioritylevel-Uid': '1d97a02a-9039-4fde-bf2e-1e9779e51408', 'Date': 'Thu, 04 Aug 2022 10:14:55 GMT', 'Content-Length': '19'})
HTTP response body: b'404 page not found\n'
HTTP request headers: <REQUEST HEADERS HERE>
HTTP request URI: <REQUEST URI HERE>
Based on this one: https://github.com/kubernetes-client/python/issues/1872