From 1a9638f5d5fc78f7e8be700e71b506fed3cc9d2d Mon Sep 17 00:00:00 2001 From: Sastry Isukapalli Date: Sat, 17 Mar 2018 02:40:15 -0400 Subject: New policies and required code changes Issue-ID: OPTFRA-146 Change-Id: I2261ae69f52b184cd7dcb7b86d5905538666a411 Signed-off-by: Sastry Isukapalli --- osdf/utils/interfaces.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'osdf/utils/interfaces.py') diff --git a/osdf/utils/interfaces.py b/osdf/utils/interfaces.py index 7a0e3a9..a869d6d 100644 --- a/osdf/utils/interfaces.py +++ b/osdf/utils/interfaces.py @@ -16,7 +16,9 @@ # ------------------------------------------------------------------------- # +import json import requests +import yaml from osdf.config.base import osdf_config, creds_prefixes from osdf.logging.osdf_logging import MH, debug_log @@ -35,6 +37,18 @@ def get_rest_client(request_json, service): return RestClient(url=callback_url, userid=c_userid, passwd=c_passwd) +def json_from_file(file_name): + """Read a policy from a file""" + with open(file_name) as fid: + return json.load(fid) + + +def yaml_from_file(file_name): + """Read a policy from a file""" + with open(file_name) as fid: + return yaml.load(fid) + + class RestClient(object): """Simple REST Client that supports get/post and basic auth""" -- cgit 1.2.3-korg