Correct session helper error and typo
This commit is contained in:
parent
7a5fa1f09b
commit
5097c69761
|
@ -8,6 +8,7 @@ import shutil
|
||||||
import uuid
|
import uuid
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
from copy import deepcopy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
sessions = {}
|
sessions = {}
|
||||||
|
@ -26,11 +27,12 @@ def expired_sessions_collector(session_timeout_duration):
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
if bool(sessions):
|
if bool(sessions):
|
||||||
for session_uuid in sessions:
|
_sessions = deepcopy(sessions)
|
||||||
_expire = datetime.datetime.strptime(sessions[session_uuid]['expire'], '%Y-%m-%d %H:%M:%S.%f')
|
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():
|
if _expire < datetime.datetime.now():
|
||||||
print("session for user: ", sessions[session_uuid]['user'], "expired.")
|
print("session for user: ", _sessions[session_uuid]['user'], "expired.")
|
||||||
response_path = (Path(__file__).parent / f'response_files/{session_uuid}').resolve()
|
response_path = (Path(__file__).parent.parent / f'response_files/{session_uuid}').resolve()
|
||||||
shutil.rmtree(response_path)
|
shutil.rmtree(response_path)
|
||||||
del sessions[session_uuid]
|
del sessions[session_uuid]
|
||||||
time.sleep(60 * int(session_timeout_duration))
|
time.sleep(60 * int(session_timeout_duration))
|
||||||
|
|
|
@ -20,7 +20,7 @@ from hub_api.helpers.session_helper import refresh_session
|
||||||
class EnergyPlus(Resource, Config):
|
class EnergyPlus(Resource, Config):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._extensions = ['.geojson', '.citygml']
|
self._extensions = ['.geojson', '.gml']
|
||||||
self._tmp_path = (Path(__file__).parent / 'tmp').resolve()
|
self._tmp_path = (Path(__file__).parent / 'tmp').resolve()
|
||||||
self._response_path = (Path(__file__).parent.parent / 'response_files').resolve()
|
self._response_path = (Path(__file__).parent.parent / 'response_files').resolve()
|
||||||
self._city = None
|
self._city = None
|
||||||
|
@ -34,7 +34,7 @@ class EnergyPlus(Resource, Config):
|
||||||
height_field = request.form.get('height_field')
|
height_field = request.form.get('height_field')
|
||||||
year_of_construction_field = request.form.get('year_of_construction_field')
|
year_of_construction_field = request.form.get('year_of_construction_field')
|
||||||
function_field = request.form.get('function_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',
|
return GeometryFactory('geojson',
|
||||||
path=file_path,
|
path=file_path,
|
||||||
height_field=height_field,
|
height_field=height_field,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user