Only update A records
This commit is contained in:
		
					parent
					
						
							
								f699af1eef
							
						
					
				
			
			
				commit
				
					
						158b701eb9
					
				
			
		
					 1 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -36,11 +36,10 @@ def get_sub_records(domain, subdomain, api_url, api_key, debug=False):
 | 
			
		|||
    return json_object[0]
 | 
			
		||||
 | 
			
		||||
def update_sub_records(domain, subdomain, api_url, api_key, ip, ttl, debug=False):
 | 
			
		||||
    url = api_url + '/domains/' + domain + '/records/' + subdomain
 | 
			
		||||
    payload = {"rrset_type": "A", "rrset_ttl": ttl, "rrset_values": [ip]}
 | 
			
		||||
    items = {"items": [payload]}
 | 
			
		||||
    url = api_url + '/domains/' + domain + '/records/' + subdomain + "/A"
 | 
			
		||||
    payload = {"rrset_values": [ip], "rrset_ttl": ttl}
 | 
			
		||||
    headers = {'Content-Type': 'application/json', 'Authorization': "Apikey " + api_key}
 | 
			
		||||
    resp = requests.put(url, data=json.dumps(items), headers=headers)
 | 
			
		||||
    resp = requests.put(url, data=json.dumps(payload), headers=headers)
 | 
			
		||||
    json_object = json.loads(resp._content)
 | 
			
		||||
    return json_object
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue