Ejemplo n.º 1
0
    def list_cmd():
        response = requests.get('http://localhost:9797/list', )

        if response.status_code == 200:
            click.echo(response.content)
        else:
            click.echo(response.content)
            sys.exit(1)
Ejemplo n.º 2
0
    def list_cmd():
        response = requests.get(
            'http://localhost:9797/list',
        )

        if response.status_code == 200:
            click.echo(response.content)
        else:
            click.echo(response.content)
            sys.exit(1)
Ejemplo n.º 3
0
    def disable_cmd(profile_ids):
        for profile_id in profile_ids:
            response = requests.put(
                'http://localhost:9797/disable/%s' % profile_id, )

            if response.status_code == 200:
                click.echo('Successfully disabled profile')
            else:
                click.echo(response.content)
                sys.exit(1)
Ejemplo n.º 4
0
    def disable_cmd(profile_ids):
        for profile_id in profile_ids:
            response = requests.put(
                'http://localhost:9797/disable/%s' % profile_id,
            )

            if response.status_code == 200:
                click.echo('Successfully disabled profile')
            else:
                click.echo(response.content)
                sys.exit(1)
Ejemplo n.º 5
0
    def enable_cmd(profile_ids):
        for profile_id in profile_ids:
            response = requests.put(
                'http://localhost:9797/enable/%s' % profile_id,
                headers=get_auth_headers(),
            )

            if response.status_code == 200:
                click.echo('Successfully enabled profile')
            else:
                click.echo(response.content)
                sys.exit(1)
Ejemplo n.º 6
0
    def enable_cmd(profile_ids):
        for profile_id in profile_ids:
            response = requests.put(
                'http://localhost:9797/enable/%s' % profile_id,
                headers=get_auth_headers(),
            )

            if response.status_code == 200:
                click.echo('Successfully enabled profile')
            else:
                click.echo(response.content)
                sys.exit(1)
Ejemplo n.º 7
0
    def import_cmd(profile_ins):
        for profile_in in profile_ins:
            data = {}
            if os.path.exists(profile_in):
                data['profile_path'] = os.path.abspath(profile_in)
            else:
                data['profile_uri'] = profile_in

            response = requests.post(
                'http://localhost:9797/import',
                headers={
                    'Content-type': 'application/json',
                },
                data=json.dumps(data),
            )

            if response.status_code == 200:
                click.echo('Successfully imported profile')
            else:
                click.echo(response.content)
                sys.exit(1)
Ejemplo n.º 8
0
    def import_cmd(profile_ins):
        for profile_in in profile_ins:
            data = {}
            if os.path.exists(profile_in):
                data['profile_path'] = os.path.abspath(profile_in)
            else:
                data['profile_uri'] = profile_in

            response = requests.post(
                'http://localhost:9797/import',
                headers=get_auth_headers({
                    'Content-type': 'application/json',
                }),
                data=json.dumps(data),
            )

            if response.status_code == 200:
                click.echo('Successfully imported profile')
            else:
                click.echo(response.content)
                sys.exit(1)
Ejemplo n.º 9
0
    def start_cmd(profile_ids, password):
        for profile_id in profile_ids:
            if password:
                headers = {
                    'Content-type': 'application/json',
                }
                data = json.dumps({
                    'passwd': password,
                })
            else:
                headers = None
                data = None

            response = requests.put(
                'http://localhost:9797/start/%s' % profile_id,
                headers=headers,
                data=data,
            )

            if response.status_code == 200:
                click.echo('Successfully started profile')
            else:
                click.echo(response.content)
                sys.exit(1)
Ejemplo n.º 10
0
    def start_cmd(profile_ids, password):
        for profile_id in profile_ids:
            if password:
                headers = {
                    'Content-type': 'application/json',
                }
                data = json.dumps({
                    'passwd': password,
                })
            else:
                headers = None
                data = None

            response = requests.put(
                'http://localhost:9797/start/%s' % profile_id,
                headers=get_auth_headers(headers),
                data=data,
            )

            if response.status_code == 200:
                click.echo('Successfully started profile')
            else:
                click.echo(response.content)
                sys.exit(1)