File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 5
5
ApiSensorIdParamLast )
6
6
7
7
api = Api ()
8
- api .add_resource (ApiEstacao , "/api/v1.1/estacao" )
9
- api .add_resource (ApiEstacaoId , "/api/v1.1/estacao/<int:estacao_id>" )
8
+ versao = "v1.2"
9
+
10
+ api .add_resource (ApiEstacao , f"/api/{ versao } /estacao" )
11
+ api .add_resource (ApiEstacaoId , f"/api/{ versao } /estacao/<int:estacao_id>" )
10
12
api .add_resource (ApiEstacaoIdSensor ,
11
- "/api/v1.1 /estacao/<int:estacao_id>/sensor" )
13
+ f "/api/{ versao } /estacao/<int:estacao_id>/sensor" )
12
14
api .add_resource (ApiSensorId ,
13
- "/api/v1.1 /sensor/<int:sensor_id>" )
15
+ f "/api/{ versao } /sensor/<int:sensor_id>" )
14
16
api .add_resource (ApiSensorIdParam ,
15
- "/api/v1.1 /sensor/<int:sensor_id>/<string:param>" )
17
+ f "/api/{ versao } /sensor/<int:sensor_id>/<string:param>" )
16
18
api .add_resource (ApiSensorIdParamLast ,
17
- "/api/v1.1 /sensor/<int:sensor_id>/<string:param>/<int:qty>" )
19
+ f "/api/{ versao } /sensor/<int:sensor_id>/<string:param>/<int:qty>" )
18
20
19
21
20
22
def init_app (app ):
Original file line number Diff line number Diff line change 9
9
10
10
$ ( function ( ) {
11
11
12
- const URL_BASE = "/api/v1.1" ;
12
+ const versao = "v1.2"
13
+ const URL_BASE = `/api/${ versao } ` ;
13
14
const TIME_UPDATE = 10000 ; // milliseconds
14
15
15
16
/**
Original file line number Diff line number Diff line change 25
25
MIN_PRES = 30
26
26
MAX_PRES = 100
27
27
28
+ VERSAO = "v1.2"
29
+
28
30
29
31
def create_all ():
30
32
estacoes = [
@@ -143,7 +145,7 @@ def simular():
143
145
for sensor , valores in zip_sensores :
144
146
params = sensor .params .split ("," )
145
147
for param in params :
146
- url = f"http://localhost:5000/api/v1.1 /sensor/{ sensor .id } /{ param } "
148
+ url = f"http://localhost:5000/api/{ VERSAO } /sensor/{ sensor .id } /{ param } "
147
149
inicial = float (valores [param ])
148
150
valor = inicial + random () * choice (LINSPACE )
149
151
leitura = Leitura (valor = valor , datahora = getDatahora ())
You can’t perform that action at this time.
0 commit comments