(email, key, domain, logger)
Get the ZoneID for the specified domain
Get the ZoneID for the specified domain
Get the ZoneID for the specified domain
def get_zoneid(email, key, domain, logger):
    ''' Get the ZoneID for the specified domain '''
    headers = {
        'X-Auth-Email' : email,
        'X-Auth-Key' : key,
        'Content-Type' : 'application/json'
    }
    url = "%s/zones?name=%s" % (baseurl, domain)
    logger.debug("cloudflare: Requesting url " + url)
    try:
        req = requests.get(url=url, headers=headers)
        if validate_response(req, logger):
            data = json.loads(req.text)
            for zone in data['result']:
                if zone['name'] == domain:
                    return zone['id']
        else:
            return None
    except:
        return None
def get_zoneid ( email , key , domain , logger ) : headers = { 'X-Auth-Email' : email , 'X-Auth-Key' : key , 'Content-Type' : 'application/json' } url = "%s/zones?name=%s" % ( baseurl , domain ) logger . debug ( "cloudflare: Requesting url " + url ) try : req = requests . get ( url = url , headers = headers ) if validate_response ( req , logger ) : data = json . loads ( req . text ) for zone in data [ 'result' ] : if zone [ 'name' ] == domain : return zone [ 'id' ] else : return None except : return None