Esempio n. 1
0
def inscript():
    #android id
    print("inscription team")
    id = request.get_json(force=True)
    jsonData = id["device_id"]
    r = requests.put('https://*****:*****@couchdb.mignolet.fr/teambd/"002"')
    return json_response(r.json(), r.status_code)
Esempio n. 2
0
async def games_list(request):
    params = request.rel_url.query
    limit = int(request.rel_url.query['limit']) if 'limit' in params else 100
    offset = int(request.rel_url.query['offset']) if 'offset' in params else 0

    data = await get_games(games_table, limit, offset)

    return json_response(data={'total': len(data), 'games': data})
Esempio n. 3
0
async def questions_list(request):
    params = request.rel_url.query
    limit = int(request.rel_url.query['limit']) if 'limit' in params else 100
    offset = int(request.rel_url.query['offset']) if 'offset' in params else 0
    theme = request.rel_url.query['theme'] if 'theme' in params else None

    data = await get_questions(questions_table, limit, offset, theme)

    return json_response(data={'total': len(data), 'questions': data})
Esempio n. 4
0
async def questions_create(request):
    question = await request.json()
    #    pprint(question)
    correct_question = data_verification(question, type='question')

    if correct_question['success']:
        correct_question = correct_question['data']
        correct_question = await form_correct_question(correct_question)
        return json_response(data=correct_question)
    else:
        return error_json_response(text_status='not ok',
                                   data=correct_question['data'])
Esempio n. 5
0
async def games_create(request):
    game = await request.json()
    order = await get_game_order(games_table, game)
    game['game_id'] = gen_game_id(game['group_id'], order)
    correct_game = data_verification(game, 'game')

    if correct_game['success']:
        correct_game = correct_game['data']
        await insert_document(games_table, correct_game.copy())
        return json_response(data=correct_game)
    else:
        return error_json_response(text_status='not ok',
                                   data=correct_game['data'])
Esempio n. 6
0
async def games_delete(request):
    game = await request.json()
    await games_table.delete_one({'game_id': game['game_id']})
    return json_response()
Esempio n. 7
0
async def questions_delete(request):
    question = await request.json()
    await questions_table.delete_one({'id': question['id']})
    return json_response()
Esempio n. 8
0
async def empty(request):
    return json_response()
Esempio n. 9
0
def ListObjet():
    print("item liste")
    r = requests.get('')
    return json_response(r.json(), r.status_code)
Esempio n. 10
0
def newsListe():
    print("newsListe")
    r = requests.get(
        'https://couchdb.mignolet.fr/objetdb/_design/_all_dbs/_view/random?limit=10&reduce=false'
    )
    return json_response(r.json(), r.status_code)
Esempio n. 11
0
def beaconSendPicture():
    print("beaconInscript")
    r = requests.get(
        'https://couchdb.mignolet.fr/beacondb/_design/type/_view/depot?reduce=false'
    )
    return json_response(r.json(), r.status_code)
Esempio n. 12
0
def hello():
    return json_response('Hello World, from router api !')