Small adjustments for meb
This commit is contained in:
parent
e2cb78842f
commit
fa06b571f8
@ -17,7 +17,7 @@ import threading
|
||||
import hub_api.helpers.session_helper as sh
|
||||
from hub_api.session import SessionStart, SessionEnd, KeepSessionAlive
|
||||
from hub_api.uptime import Uptime
|
||||
from hub_api.buildings import GetMEB
|
||||
from hub_api.buildings.meb import Meb
|
||||
|
||||
|
||||
sh.begin_time = datetime.datetime.now()
|
||||
@ -33,7 +33,7 @@ api.add_resource(SessionEnd, '/v1.4/session/end')
|
||||
api.add_resource(KeepSessionAlive, '/v1.4/session/keep_alive')
|
||||
|
||||
# Buildings
|
||||
api.add_resource(GetMEB, '/v1.4/buildings/meb')
|
||||
api.add_resource(Meb, '/v1.4/buildings/meb')
|
||||
|
||||
with open("hub_api/docs/openapi-specs.yml", "r") as stream:
|
||||
swagger_config = {
|
||||
@ -53,7 +53,7 @@ with open("hub_api/docs/openapi-specs.yml", "r") as stream:
|
||||
try:
|
||||
Swagger(app, template=yaml.safe_load(stream), config=swagger_config)
|
||||
except yaml.YAMLError as exc:
|
||||
print(exc)
|
||||
print(f'error: {exc}')
|
||||
|
||||
|
||||
@app.route("/")
|
||||
|
@ -5,19 +5,19 @@ from flask_restful import Resource
|
||||
from hub_api.helpers.session_helper import active_session, refresh_session
|
||||
from hub_api.config import Config
|
||||
|
||||
class GetMEB(Resource, Config):
|
||||
class Meb(Resource, Config):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def post(self):
|
||||
'''
|
||||
def get(self):
|
||||
"""
|
||||
API call for requesting a specified list of enriched buildings
|
||||
'''
|
||||
"""
|
||||
session_id = request.headers.get('session_id', None)
|
||||
token = request.headers.get('token', None)
|
||||
application_uuid = request.headers.get('application_uuid', None)
|
||||
|
||||
if(active_session(session_id, token, application_uuid)):
|
||||
if active_session(session_id, token, application_uuid):
|
||||
refresh_session(session_id, token, application_uuid)
|
||||
payload = request.get_json()
|
||||
buildings = {}
|
||||
@ -27,7 +27,7 @@ class GetMEB(Resource, Config):
|
||||
for building in payload['cities'][city]:
|
||||
buildings[city][building] = self.export_db_factory.building_info(building, city)
|
||||
|
||||
#TODO: finish formating buildings to match swagger documentation
|
||||
# TODO: finish formatting buildings to match swagger documentation
|
||||
# and change export_db_factory.building_info to use MEB database
|
||||
# call when ready
|
||||
|
@ -140,28 +140,19 @@ paths:
|
||||
schema:
|
||||
$ref: '#/components/schemas/unauthorized'
|
||||
/v1.4/buildings/meb:
|
||||
post:
|
||||
get:
|
||||
security:
|
||||
- session_id: [ ]
|
||||
- token: [ ]
|
||||
- application_uuid: [ ]
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
cities:
|
||||
type: object
|
||||
example: {"city_1" :["building_1", "building_2"], "city_2" :["building_3", "building_8"]}
|
||||
|
||||
# schema:
|
||||
# ref: '#components/schemas/buildingsArray'
|
||||
# payload:
|
||||
# type: object
|
||||
# example: {"city_1" :["building_1", "building_2"], "city_2" :["building_3", "building_8"]}
|
||||
# required: true
|
||||
# description: Json containing the city name and the buildings whose monthly energy balance is requested.
|
||||
parameters:
|
||||
- in: body
|
||||
name: data
|
||||
schema:
|
||||
type: string
|
||||
example: [{"city_1" :["building_1", "building_2"]}, {"city_2" :["building_3", "building_8"]}]
|
||||
required: true
|
||||
description: Json containing the city name and the buildings whose monthly energy balance is requested.
|
||||
tags:
|
||||
- Buildings monthly energy balance meb
|
||||
summary: Retrieve the monthly energy balance results for the given buildings in the given cities
|
||||
@ -229,19 +220,6 @@ components:
|
||||
cities:
|
||||
type: array
|
||||
example: [{'name': 'city 1', 'geometric_level_of_detail': '1'}, {'name': 'city 2', 'geometric_level_of_detail': '1'}]
|
||||
buildingsArray:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/buildings'
|
||||
buildings:
|
||||
type: object
|
||||
properties:
|
||||
city_id:
|
||||
type: string
|
||||
example: 'city_id1'
|
||||
meb:
|
||||
type: object
|
||||
properties:
|
||||
|
Loading…
Reference in New Issue
Block a user