Ejemplo n.º 1
0
        "environments": {
            "Production": {
                "rollout_rules": [{
                    "audience_ids": [audience_id],
                    "enabled": True,
                    "percentage_included": 1000
                }]
            }
        },
        "variables": [{
            "id": variable_id,
            "default_value": "true",
            "key": variable_key + '_updated',
            "type": "string",
            "archived": True,
            "description": variable_description + '_updated'
        }]
    }
    et.print_request_details('PATCH', url, feature, headers)
    r = requests.patch(url, data=json.dumps(feature), headers=headers)
    j = r.json()
    et.print_response_details(r.status_code, j)
    return j['id']


et.print_new_method('Create a new feature')
(id, variable_id) = create_feature()

et.print_new_method('Update the feature')
update_feature(id, variable_id)
Ejemplo n.º 2
0
    j = r.json()
    et.print_response_details(r.status_code, j)
    return r.json()['id']


def update_group(id):
    url = base_url + '/groups/' + str(id)

    group = {
        'project_id': project_id,
        'archived': False,
        'description': 'A new group updated',
        'name': name + ' updated',
        'entities': [{
            "id": experiment_id,
            "kind": "Experiment",
            "weight": 5000
        }]
    }
    et.print_request_details('PATCH', url, group, headers)
    r = requests.patch(url, data=json.dumps(group), headers=headers)
    j = r.json()
    et.print_response_details(r.status_code, j)


et.print_new_method('Create a new group')
id = create_group()

et.print_new_method('Update the group')
update_group(id)
Ejemplo n.º 3
0
        "project_id":
        project_id,
        "archived":
        False,
        "conditions":
        '["and", ["or", ["or", {"name": "' + custom_audience_attribute +
        '", "type": "custom_attribute", "value": "full stack value"}], ["or", {"name": "'
        + custom_audience_attribute +
        '", "type": "custom_attribute", "value": "val 2"}]]]',
        "description":
        "Using a Full Stack attribute",
        "is_classic":
        False,
        "name":
        name + '_updated',
        "segmentation":
        False
    }

    et.print_request_details('PATCH', url, audience, headers)
    r = requests.patch(url, data=json.dumps(audience), headers=headers)
    j = r.json()
    et.print_response_details(r.status_code, j)


et.print_new_method('Create a new audience')
id = create_audience()

et.print_new_method('Update the audience')
update_audience(id)
Ejemplo n.º 4
0
    r = requests.post(url, data=json.dumps(attribute), headers=headers)

    j = r.json()
    et.print_response_details(r.status_code, j)
    return j['id']


def update_attribute(id):
    url = base_url + '/attributes/' + str(id)

    attribute = {
        'key': key + '_updated',
        'project_id': project_id,
        'archived': False,
        'description': description + ' - updated',
        'name': name + ' - updated',
    }

    et.print_request_details('PATCH', url, attribute, headers)

    r = requests.patch(url, data=json.dumps(attribute), headers=headers)

    j = r.json()
    et.print_response_details(r.status_code, j)

et.print_new_method('Create a new attribute')
id = create_attribute()

et.print_new_method('Update the attribute')
update_attribute(id)
Ejemplo n.º 5
0
            "archived": False,
            "description": "blabla_2",
            "key": variation_key + '_updated_2',
            "variation_id": variation_id
        }]
    }

    if feature_id:
        experiment['feature_id'] = feature_id
        if len(variable_values) > 0:
            experiment['variations'][0]['variable_values'] = variables
            experiment['variations'][0]['feature_enabled'] = True

    et.print_request_details('PATCH', url, experiment, headers)
    r = requests.patch(url, data=json.dumps(experiment), headers=headers)
    j = r.json()
    et.print_response_details(r.status_code, j)


et.print_new_method('Create a new experiment')
id, variation_id = create_experiment()

et.print_new_method('Update and start the experiment')
update_start_experiment(id, variation_id)

et.print_new_method('Pause the experiment')
pause_experiment(id)

et.print_new_method('Update the experiment #2')
update_experiment_2(id, variation_id)
Ejemplo n.º 6
0
import requests
import json
import pprint


def create_result():

    url = base_url + '/experiments/' + str(experiment_id) + '/results'
    et.print_request_details('GET', url, {}, headers)
    r = requests.get(url, headers=headers)
    print r.text
    j = r.json()
    et.print_response_details(r.status_code, j)

    url = base_url + '/experiments/' + str(experiment_id) + '/timeseries'
    et.print_request_details('GET', url, {}, headers)
    r = requests.get(url, headers=headers)
    j = r.json()
    et.print_response_details(r.status_code, j)

    url = base_url + '/export/experiments/' + str(
        experiment_id) + '/results/csv'
    et.print_request_details('GET', url, {}, headers)
    r = requests.get(url, headers=headers)
    et.print_response_details(r.status_code, {})
    print(r.text)


et.print_new_method('Get experiment results')
create_result()
Ejemplo n.º 7
0
    }
    et.print_request_details('POST', url, project, headers)
    r = requests.post(url, data=json.dumps(project), headers=headers)
    j = r.json()
    et.print_response_details(r.status_code, j)
    return r.json()['id']


def update_project(id):
    url = base_url + '/projects/' + str(id)

    project = {
        'name': name + "_updated",
        'confidence_threshold': 0.9,
        'description': description + "_updated",
        'platform': 'custom',
        'sdks': ['python'],
        'status': 'active',
    }
    et.print_request_details('PATCH', url, project, headers)
    r = requests.patch(url, data=json.dumps(project), headers=headers)
    j = r.json()
    et.print_response_details(r.status_code, j)


et.print_new_method('Create a new project')
id = create_project()

et.print_new_method('Update the project')
update_project(id)