How to use the oasislmf.api.client.APIClient function in oasislmf

To help you get started, we’ve selected a few oasislmf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OasisLMF / OasisPlatform / tests / integration / api_integration.py View on Github external
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