How to use the oasislmf.utils.http 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 / server.bak / app.py View on Github external
description: Resource not found
    parameters:
    - name: location
      in: path
      description: The location of the analysis status resource to delete.
      required: true
      type: string
    """

    raise Exception("Not implemented")

    try:
        logging.debug("Location: {}".format(location))
    except Exception:
        logging.exception("Failed to delete analysis status")
        response = Response(status=http.HTTP_RESPONSE_INTERNAL_SERVER_ERROR)
    return response
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
- name: location
      in: path
      description: location of exposure resource to delete.
      required: true
      type: string
    """
    logging.debug("Location: {}".format(location))
    if location is None:
        for filename in os.listdir(settings.get('server', 'INPUTS_DATA_DIRECTORY')):
            filepath = os.path.join(settings.get('server', 'INPUTS_DATA_DIRECTORY'), filename)
            if not filepath.endswith(TAR_FILE_SUFFIX):
                continue
            if not os.path.isfile(filepath):
                continue
            os.remove(filepath)
        response = Response(status=http.HTTP_RESPONSE_OK)
    else:
        filename = str(location) + TAR_FILE_SUFFIX
        filepath = os.path.join(settings.get('server', 'INPUTS_DATA_DIRECTORY'), filename)

        if not os.path.exists(filepath):
            response = Response(status=http.HTTP_RESPONSE_RESOURCE_NOT_FOUND)
        else:
            os.remove(filepath)
            response = Response(status=http.HTTP_RESPONSE_OK)

    return response