Python PUT requests to nexus repo

Viewed 28

I have a nexus, yum proxy repo which has some components as below

 "name": "internal-test",
 "online": true,
 "storage": {
   "blobStoreName": "default",
   "strictContentTypeValidation": true
 },
 "cleanup": {
   "policyNames": [
     "string"
   ]
 },
 "proxy": {
   "remoteUrl": "https://remote.repository.com",
   "contentMaxAge": 1440,
   "metadataMaxAge": 1440
 },
 "negativeCache": {
   "enabled": true,
   "timeToLive": 1440
 },
 "httpClient": {
   "blocked": false,
   "autoBlock": true,
   "connection": {
     "retries": 0,
     "userAgentSuffix": "string",
     "timeout": 60,
     "enableCircularRedirects": false,
     "enableCookies": false,
     "useTrustStore": false
   },
   "authentication": {
     "type": "username",
     "username": "string",
     "password": "string",
     "ntlmHost": "string",
     "ntlmDomain": "string"
   }
 },
 "routingRule": "string",
 "yumSigning": {
   "keypair": "string",
   "passphrase": "string"
 }
}'

I am trying to use requests in python and used below code to modify "metadataMaxAge": 1440 parameter in nexus repo (as shown above) to this metadataMaxAge": -1.

url = "https://***/"
auth1 = ('user', 'pasword')
payload  = {'metadataMaxAge': '-1'}
res = requests.put(url, json=payload, auth=auth1, verify=False)

But I get the response 400, so can anyone help me out here on how to fix this ?

0 Answers
Related