diff --git a/hub_api/helpers/session_helper.py b/hub_api/helpers/session_helper.py index 580da42..371e071 100644 --- a/hub_api/helpers/session_helper.py +++ b/hub_api/helpers/session_helper.py @@ -8,6 +8,7 @@ import shutil import uuid import datetime import time +from copy import deepcopy from pathlib import Path sessions = {} @@ -26,11 +27,12 @@ def expired_sessions_collector(session_timeout_duration): """ while True: if bool(sessions): - for session_uuid in sessions: - _expire = datetime.datetime.strptime(sessions[session_uuid]['expire'], '%Y-%m-%d %H:%M:%S.%f') + _sessions = deepcopy(sessions) + for session_uuid in _sessions: + _expire = datetime.datetime.strptime(_sessions[session_uuid]['expire'], '%Y-%m-%d %H:%M:%S.%f') if _expire < datetime.datetime.now(): - print("session for user: ", sessions[session_uuid]['user'], "expired.") - response_path = (Path(__file__).parent / f'response_files/{session_uuid}').resolve() + print("session for user: ", _sessions[session_uuid]['user'], "expired.") + response_path = (Path(__file__).parent.parent / f'response_files/{session_uuid}').resolve() shutil.rmtree(response_path) del sessions[session_uuid] time.sleep(60 * int(session_timeout_duration)) diff --git a/hub_api/workflow/energy_plus.py b/hub_api/workflow/energy_plus.py index a85f11d..1fca8a9 100644 --- a/hub_api/workflow/energy_plus.py +++ b/hub_api/workflow/energy_plus.py @@ -20,7 +20,7 @@ from hub_api.helpers.session_helper import refresh_session class EnergyPlus(Resource, Config): def __init__(self): super().__init__() - self._extensions = ['.geojson', '.citygml'] + self._extensions = ['.geojson', '.gml'] self._tmp_path = (Path(__file__).parent / 'tmp').resolve() self._response_path = (Path(__file__).parent.parent / 'response_files').resolve() self._city = None @@ -34,7 +34,7 @@ class EnergyPlus(Resource, Config): height_field = request.form.get('height_field') year_of_construction_field = request.form.get('year_of_construction_field') function_field = request.form.get('function_field') - function_dictionary = self._dictionaries[request.form.get('function_dictionary_name')] + function_dictionary = self._dictionaries[request.form.get('function_to_hub')] return GeometryFactory('geojson', path=file_path, height_field=height_field,