-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
62 lines (49 loc) · 1006 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from fastapi import FastAPI
api = FastAPI(title="Mon API pour les Orange DE")
@api.get('/')
def get_index():
return {
"message": "Hello world!"
}
@api.get(
'/mon_endpoint',
tags=["demo"],
responses={
200: {
"description": "tout a marché comme sur des roulettes"
},
501: {
"description": "tout va mal"
}
}
)
def get_mon_endpoint(nombre_entier: int):
"""Renvoie un modele de dictionnaire
"""
return {
"un_nombre": nombre_entier,
"un_dictionnaire": {
"une_clef": "une_valeur",
"une_autre_clef": "une_autre_valeur"
}
}
@api.post('/mon_premier_post')
def post_mon_premier_post():
return {
"hello": "world"
}
@api.get('/health')
def get_health():
return {
"status": 1
}
@api.post('/')
def post_index():
return {
"status": 1
}
@api.get("/bye")
def get_bye():
return {
"bye": "bye"
}