コード例 #1
0
def enroll_face(subject_id,
                gallery_name,
                url=None,
                file=None,
                additional_arguments={}):
    utils.validate_settings()
    utils.validate_file_and_url_presence(file, url)

    auth_headers = {
        'Content-type': 'application/json',
        'Accept': 'text/plain',
        'app_id': settings.app_id,
        'app_key': settings.app_key
    }

    payload = _build_payload(subject_id, gallery_name, url, file,
                             additional_arguments)

    response = requests.post(_enroll_base_url,
                             data=json.dumps(payload),
                             headers=auth_headers)
    json_response = response.json()
    if response.status_code != 200 or 'Errors' in json_response:
        raise exceptions.ServiceRequestError(response.status_code,
                                             json_response, payload)

    return json_response
コード例 #2
0
ファイル: server.py プロジェクト: farid979797/multi-snake
def run(host=settings.SERVER_HOST, port=settings.SERVER_PORT):
    validate_settings(settings)

    app = web.Application()
    app['game'] = Game()

    app.router.add_route('GET', '/connect', ws_handler)
    app.router.add_static('/', settings.WEB_ROOT)

    app.on_shutdown.append(on_shutdown)

    web.run_app(app, host=host, port=port)
コード例 #3
0
ファイル: remove.py プロジェクト: erenhukumdar/dolaresNFCApp
def remove_face(subject_id, gallery_name):
    validate_settings()
    _validate_arguments_presence(gallery_name, subject_id)

    auth_headers = {'app_id': settings.app_id, 'app_key': settings.app_key}

    payload = _build_payload(gallery_name, subject_id)

    response = requests.post(_remove_base_url,
                             json=payload,
                             headers=auth_headers)
    json_response = response.json()
    if response.status_code != 200 or 'Errors' in json_response:
        raise exceptions.ServiceRequestError(response.status_code,
                                             json_response, payload)

    return json_response
コード例 #4
0
def verify_face(subject_id, gallery_name, url=None, file=None, additional_arguments={}):
    validate_settings()
    validate_file_and_url_presence(file, url)

    auth_headers = {
        'app_id': settings.app_id,
        'app_key': settings.app_key
    }

    payload = _build_payload(subject_id, gallery_name, url, file, additional_arguments)

    response = requests.post(_verify_base_url, json=payload, headers=auth_headers)
    json_response = response.json()
    if response.status_code != 200 or 'Errors' in json_response:
        raise exceptions.ServiceRequestError(response.status_code, json_response, payload)

    return json_response