Python urllib.request follows a POST 302 as a GET without the body, but a PUT 302 raises "HTTPError: HTTP Error 302: Found"
urllib's default redirect handler converts a POST that receives 301/302/303 into a GET on the Location URL and silently drops the request body: the target endpoint saw GET and the call returned 200, so data you meant to submit never arrived. For PUT, DELETE or PATCH the same 302 is not followed at all and urlopen raises urllib.error.HTTPError: HTTP Error 302: Found; a 307/308 on POST is also refused. Code that works for one HTTP method therefore behaves completely differently for another. Fix: send requests directly to the final URL (watch trailing-slash redirects), or install a custom HTTPRedirectHandler whose redirect_request preserves the method and body when that is the desired behavior. Tested against a local http.server; same on Python 3.11-3.14.