These are the default headers (they come from the underlying python requests module.
First thing I’d try is define the headers you don’t want with a value of None, with a bit of luck that will un-define them
I’ve never done it but if you use PUT On Session you may be able to use Update Session to remove them before the PUT.
If you are using PUT, maybe not because the requests module creates a temporary session to make the PUT call, and that temporary session creates the default headers.
I found this example of removing the default headers in python for the requests module, so it’s possible in the underlying code, just not sure if there’s anything implemented in this library.
What is the problem you’re running into? It’s typical for frameworks / libraries / browsers / etc. to inject headers. What issue are you trying to resolve?
Some of those are necessary for the backend endpoint to respond correctly to your api call.
User-agent: not required
Accept-Encoding: not required but indicates to the server if it can compress the response to avoid sending the response in plain-text. This is not required but if client provides this, backend server can optimize the amount of data that actually gets transfered back to you as reply to your call.
Connection: This typically indicates that client can re-use the same socket for consecutive requests and server now knows this. If used without keep-alive, every consecutive request you make against the same server will close the tcp socket and re-open it again if new request is done. This will slow down the overall performannce. So, at least adviced to use it.
Accept: this tells the backend server what format the client accepts the response in. Might not be required and since this is wild-card “accept anything”, most likely not necessary. Most of the real-world scenarios use same value here as Content-type
Content-Length: required but its presence depends on what http method are are using. Since you are putting a json, backend server needs to know the lenght of data you are sending and requests calculates that for you so that you do not need to do it manually.
So in general, all of those headers except user-agent do serve an actual purpose for your client and backend communicating and removing all of them sounds like a bad idea.