User preferences change example can be found in C# Example Application. Apart from C# source code, the application also shows HTTP requests and responses in HTTP tab.
The application demonstrates how to change PartialEmbargoedReportsEnabled user preference in Update User Preferences under User Examples section.
The first step is to get all user preferences. My PartialEmbargoedReportsEnabled user preference is true like example below:
The next step is to update the preferences using PUT method. The body is all user preferences got from the first step with the changed preference. In this example, it sets PartialEmbargoedReportsEnabled to be false. Then, you should receive the successful response, 204 HTTP response code.
Hope this help.
Can you try the json parameter in requests.put() method instead of data parameter? For more information, please see this guide.
requests.put(Url, json=body, headers=requestHeaders)
Normally, the reason of status 400 (bad request) will be provided in the response body. You can also add the following code to get more information from response body.
res = requests.put(....) print(res.text)
If the issue still persist, please share the body of status 400.