oasislmf.platform_api.client¶
Classes¶
Used to Implement the default requests common to all Oasis API |
|
Used for JSON data End points. |
|
File Resources Endpoint for Upload / Downloading |
|
Used to Implement the default requests common to all Oasis API |
|
Used to Implement the default requests common to all Oasis API |
|
Used to Implement the default requests common to all Oasis API |
|
Module Contents¶
- class oasislmf.platform_api.client.ApiEndpoint(session, url_endpoint, logger=None)[source]¶
Bases:
object
Used to Implement the default requests common to all Oasis API End points.
- class oasislmf.platform_api.client.JsonEndpoint(session, url_endpoint, url_resource, logger=None)[source]¶
Bases:
object
Used for JSON data End points.
- class oasislmf.platform_api.client.FileEndpoint(session, url_endpoint, url_resource, logger=None)[source]¶
Bases:
object
File Resources Endpoint for Upload / Downloading
- class oasislmf.platform_api.client.API_models(session, url_endpoint)[source]¶
Bases:
ApiEndpoint
Used to Implement the default requests common to all Oasis API End points.
- class oasislmf.platform_api.client.API_portfolios(session, url_endpoint)[source]¶
Bases:
ApiEndpoint
Used to Implement the default requests common to all Oasis API End points.
- class oasislmf.platform_api.client.API_analyses(session, url_endpoint)[source]¶
Bases:
ApiEndpoint
Used to Implement the default requests common to all Oasis API End points.
- class oasislmf.platform_api.client.APIClient(api_url='http://localhost:8000', api_ver='V2', username='admin', password='password', timeout=25, logger=None, **kwargs)[source]¶
Bases:
object
- upload_portfolio_file(portfolio_id, portfolio_file, upload_data)[source]¶
Upload a portfolio file using the API. Supports absolute filepaths or bytestreams.
If uploading a byte stream upload_data is a dict with the keys name which is a str containing the filename and bytes containing the byte stream of the file data. For example:
```python upload_portfolio_file(<portfolio_id>, “location_file”,
{‘bytes’: <byte_stream>, ‘name’: <filename>})
Parameters :param portfolio_id: Portfolio {id} from :type portfolio_id: int
- Parameters:
portfolio_file – The name of the portfolio file to update. One of the following options location_file, accounts_file, reinsurance_info_file or reinsurance_scope_file.
upload_data – The file to upload through the api. This should be
a str if it is a filepath or a dict if it is a byte stream with the keys name and bytes corresponding to the filename and bytestream respectively. :type upload_data: [str, dict] ———-
- upload_inputs(portfolio_name=None, portfolio_id=None, location_fp=None, accounts_fp=None, ri_info_fp=None, ri_scope_fp=None)[source]¶
- upload_settings(analyses_id, settings)[source]¶
Upload an analyses run settings to an API
Method to post JSON data or upload a settings file containing JSON data
Parameters¶
- param analyses_id:
Analyses settings {id} from, v1/analyses/{id}/settings
- type analyses_id:
int
- param settings:
Either a valid filepath or dictionary holding the settings
- type settings:
[str, dict]
- return:
:rtype None
- run_generate(analysis_id, poll_interval=5)[source]¶
Generates the inputs for the analysis based on the portfolio. The analysis must have one of the following statuses, NEW, INPUTS_GENERATION_ERROR, INPUTS_GENERATION_CANCELLED, READY, RUN_COMPLETED, RUN_CANCELLED or RUN_ERROR.
- run_analysis(analysis_id, analysis_settings_fp=None, poll_interval=5)[source]¶
Runs all the analysis. The analysis must have one of the following statuses, NEW, RUN_COMPLETED, RUN_CANCELLED or RUN_ERROR
- download_output(analysis_id, download_path='', filename=None, clean_up=False, overwrite=True)[source]¶