How to use the oasislmf.api_client.client.OasisAPIClient 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 / src / utils / api_tester_old.py View on Github external
def run_analysis(c):
    try:

        upload_directory = os.path.join("upload", str(uuid.uuid1()))

        shutil.copytree(
            os.path.join(input_data_directory, "csv"),
            upload_directory)

        client = OasisAPIClient(api_url, logging.getLogger())
        input_location = client.upload_inputs_from_directory(
            upload_directory, do_il, do_validation=False)
        client.run_analysis(
            analysis_settings, input_location,
            output_data_directory, do_clean=False)
        c.increment_num_completed()

    except Exception:
        logging.exception("API test failed")
        c.increment_num_failed()