pradelf commited on
Commit
35969a2
·
1 Parent(s): dd44a35

feat: add config module for versioning and update API versioning in app

Browse files
Files changed (2) hide show
  1. app.py +10 -3
  2. config.py +1 -0
app.py CHANGED
@@ -2,6 +2,7 @@ from fastapi import FastAPI
2
  from pydantic import BaseModel
3
  import mlflow.pyfunc
4
  import pandas as pd
 
5
 
6
  description = """
7
  Bienvenue sur l'API de Getaround pour prédire le prix journalier de location d'une voiture en fonction de son année d'expérience!
@@ -43,7 +44,7 @@ tags_metadata = [
43
  app = FastAPI(
44
  title="Getaround API pour le prix journalier de location d'une voiture.",
45
  description=description,
46
- version="0.1",
47
  contact={
48
  "name": "Francis Pradel",
49
  "url": "https://promotion.francispradel.fr",
@@ -67,13 +68,19 @@ class RentalFeatures(BaseModel):
67
  winter_tires: int
68
 
69
 
70
- @app.get("/")
71
  def greet_json():
72
- return {"Hello": "World!"}
 
 
 
73
 
74
 
75
  @app.get("/health")
76
  def health():
 
 
 
77
  return {"status": "ok"}
78
 
79
 
 
2
  from pydantic import BaseModel
3
  import mlflow.pyfunc
4
  import pandas as pd
5
+ import config
6
 
7
  description = """
8
  Bienvenue sur l'API de Getaround pour prédire le prix journalier de location d'une voiture en fonction de son année d'expérience!
 
44
  app = FastAPI(
45
  title="Getaround API pour le prix journalier de location d'une voiture.",
46
  description=description,
47
+ version=config.__version__,
48
  contact={
49
  "name": "Francis Pradel",
50
  "url": "https://promotion.francispradel.fr",
 
68
  winter_tires: int
69
 
70
 
71
+ @app.get("/", tags=["Introduction Endpoints"])
72
  def greet_json():
73
+ """
74
+ Bonjour
75
+ """
76
+ return {"Hello": "World!", "version": config.__version__}
77
 
78
 
79
  @app.get("/health")
80
  def health():
81
+ """
82
+ Health line to monitor the server status of the API. Returns "ok" if the server is running without issues.
83
+ """
84
  return {"status": "ok"}
85
 
86
 
config.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __version__ = "0.0.1"