(email, key, zoneid, logger, rec)
Add a new DNS record using the rec dictionary as json data
Add a new DNS record using the rec dictionary as json data
Add a new DNS record using the rec dictionary as json data
def add_rec(email, key, zoneid, logger, rec):
    ''' Add a new DNS record using the rec dictionary as json data '''
    headers = {
        'X-Auth-Email' : email,
        'X-Auth-Key' : key,
        'Content-Type' : 'application/json'
    }
    url = "%s/zones/%s/dns_records" % (baseurl, str(zoneid))
    payload = json.dumps(rec)
    try:
        req = requests.post(url=url, headers=headers, data=payload)
        return validate_response(req, logger)
    except:
        return False
def add_rec ( email , key , zoneid , logger , rec ) : headers = { 'X-Auth-Email' : email , 'X-Auth-Key' : key , 'Content-Type' : 'application/json' } url = "%s/zones/%s/dns_records" % ( baseurl , str ( zoneid ) ) payload = json . dumps ( rec ) try : req = requests . post ( url = url , headers = headers , data = payload ) return validate_response ( req , logger ) except : return False