(rec, usrdata, service_mode=False)
Add a record to cloudflares DNS zone
Add a record to cloudflares DNS zone
Add a record to cloudflares DNS zone
def addRecord(rec, usrdata, service_mode=False):
    """ Add a record to cloudflares DNS zone """
    # Call api
    rec2 = [('a', 'rec_edit')]
    for x in rec:
        rec2.append(x)
    request = ('a', 'rec_new')
    rec.append(request)
    json_data = callAPI(rec, usrdata)

    if json_data["result"] == "success":
        if service_mode is True:
            id = ('id', json_data["response"]["rec"]["obj"]["rec_id"])
            rec2.append(id)
            json_data2 = callAPI(rec2, usrdata)
            if json_data2["result"] == "success":
                return True
            else:
                return False
        else:
            return True
    else:
        return False
def addRecord ( rec , usrdata , service_mode = False ) : # Call api rec2 = [ ( 'a' , 'rec_edit' ) ] for x in rec : rec2 . append ( x ) request = ( 'a' , 'rec_new' ) rec . append ( request ) json_data = callAPI ( rec , usrdata ) if json_data [ "result" ] == "success" : if service_mode is True : id = ( 'id' , json_data [ "response" ] [ "rec" ] [ "obj" ] [ "rec_id" ] ) rec2 . append ( id ) json_data2 = callAPI ( rec2 , usrdata ) if json_data2 [ "result" ] == "success" : return True else : return False else : return True else : return False