Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def session_fixture(request):
server_addr = config.get('server', 'API_HOST')
server_port = config.get('server', 'API_PORT')
server_vers = config.get('server', 'API_VERS')
server_user = config.get('server', 'API_USER')
server_pass = config.get('server', 'API_PASS')
print(request.param)
try:
server_url = 'http://{}:{}'.format(socket.gethostbyname(server_addr), server_port)
except Exception:
server_url = 'http://{}:{}'.format('localhost', server_port)
session = APIClient(server_url, server_vers, server_user, server_pass)
print(session.api.tkn_access)
return request.param, session