try to fix db connection
This commit is contained in:
parent
e7c49e7e25
commit
7be95d7cc5
|
@ -16,10 +16,10 @@ class Config:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
dotenv_path = "{}/.env".format(os.path.expanduser('~'))
|
dotenv_path = "{}/.env".format(os.path.expanduser('~'))
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
dotenv_path = Path('/usr/local/etc/hub/.env').resolve()
|
dotenv_path = Path('/.local/etc/hub_api/.env').resolve()
|
||||||
|
|
||||||
environment = 'TEST'
|
environment = 'TEST'
|
||||||
database_name = 'persistence_test'
|
database_name = 'montreal_retrofit_test'
|
||||||
|
|
||||||
self.export_db_factory = CityExportFactory(db_name=database_name, app_env=environment,
|
self.export_db_factory = CityExportFactory(db_name=database_name, app_env=environment,
|
||||||
dotenv_path=dotenv_path)
|
dotenv_path=dotenv_path)
|
||||||
|
|
|
@ -22,9 +22,10 @@ class SessionStart(Resource, Config):
|
||||||
def put(self):
|
def put(self):
|
||||||
username = request.headers.get('username', None)
|
username = request.headers.get('username', None)
|
||||||
password = request.headers.get('password', None)
|
password = request.headers.get('password', None)
|
||||||
application_uuid = request.headers.get('application_uuid', None)
|
application_uuid = request.headers.get('application-uuid', None)
|
||||||
ip = request.remote_addr
|
ip = request.remote_addr
|
||||||
user_info = self.export_db_factory.user_login(name=username, password=password, application_uuid=application_uuid)
|
user_info = self.export_db_factory.user_login(name=username, password=password, application_uuid=application_uuid)
|
||||||
|
print(user_info, username, password, application_uuid)
|
||||||
if user_info:
|
if user_info:
|
||||||
session_id = str(uuid.uuid4())
|
session_id = str(uuid.uuid4())
|
||||||
token = str(uuid.uuid4())
|
token = str(uuid.uuid4())
|
||||||
|
|
|
@ -41,7 +41,7 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: the password for the user accessing this API
|
description: the password for the user accessing this API
|
||||||
- in: header
|
- in: header
|
||||||
name: application_uuid
|
name: application-uuid
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
@ -49,7 +49,7 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- Session start
|
- Session start
|
||||||
summary: Starts an user session
|
summary: Starts an user session
|
||||||
operationId: session_start
|
operationId: session-start
|
||||||
description: Authentication and initialization of a user session in the Api
|
description: Authentication and initialization of a user session in the Api
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
|
@ -59,7 +59,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/login_succeed'
|
$ref: '#/components/schemas/login_succeed'
|
||||||
headers:
|
headers:
|
||||||
session_id:
|
session-id:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
description: Session id
|
description: Session id
|
||||||
|
@ -78,9 +78,9 @@ paths:
|
||||||
/api/v1.4/session/keep_alive:
|
/api/v1.4/session/keep_alive:
|
||||||
put:
|
put:
|
||||||
security:
|
security:
|
||||||
- session_id: []
|
- session-id: []
|
||||||
- token: []
|
- token: []
|
||||||
- application_uuid: []
|
- application-uuid: []
|
||||||
parameters:
|
parameters:
|
||||||
[]
|
[]
|
||||||
tags:
|
tags:
|
||||||
|
@ -110,7 +110,7 @@ paths:
|
||||||
/api/v1.4/session/end:
|
/api/v1.4/session/end:
|
||||||
put:
|
put:
|
||||||
security:
|
security:
|
||||||
- session_id: []
|
- session-id: []
|
||||||
- token: []
|
- token: []
|
||||||
- application_uuid: []
|
- application_uuid: []
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -142,7 +142,7 @@ paths:
|
||||||
/api/v1.4/buildings/meb:
|
/api/v1.4/buildings/meb:
|
||||||
post:
|
post:
|
||||||
security:
|
security:
|
||||||
- session_id: [ ]
|
- session-id: [ ]
|
||||||
- token: [ ]
|
- token: [ ]
|
||||||
- application_uuid: [ ]
|
- application_uuid: [ ]
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -182,14 +182,14 @@ paths:
|
||||||
$ref: '#/components/schemas/unauthorized'
|
$ref: '#/components/schemas/unauthorized'
|
||||||
components:
|
components:
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
session_id:
|
session-id:
|
||||||
type: apiKey
|
type: apiKey
|
||||||
in: header
|
in: header
|
||||||
name: session_id
|
name: session-id
|
||||||
application_uuid:
|
application-uuid:
|
||||||
type: apiKey
|
type: apiKey
|
||||||
in: header
|
in: header
|
||||||
name: application_uuid
|
name: application-uuid
|
||||||
token:
|
token:
|
||||||
type: apiKey
|
type: apiKey
|
||||||
in: header
|
in: header
|
||||||
|
|
Loading…
Reference in New Issue
Block a user