Ejemplo n.º 1
0
def handle_status_request():
    if not request.json or 'addition' not in request.json.keys() \
            or 'uuid' not in request.json['addition']:
        return json.dumps(
            Response(result=False,
                     description={
                         'error': strings.WRONG_DATA_ERROR
                     }).to_dict())

    operation_result = Account.get_info(
        account_id=request.json['addition']['uuid'])
    return json.dumps(
        Response(result=operation_result.result,
                 description=operation_result.description,
                 addition={
                     'uuid': request.json['addition']['uuid']
                 }).to_dict())
Ejemplo n.º 2
0
    def post(self, request):
        post_data = request.data
        practices, suggestions = RankingsApiView.get_results(
            post_data.get('answers'), post_data.get('practice_blacklist', []),
            post_data.get('type_blacklist', []))

        response = Response(practices, suggestions)
        data = JSONRenderer().render(ResponseSerializer(response).data)

        return HttpResponse(data, content_type="application/json")
Ejemplo n.º 3
0
def handle_ping_request():
    return json.dumps(Response(result=True).to_dict())