Commit c065f9ae authored by Thomas Gehrmann [SLB]'s avatar Thomas Gehrmann [SLB]
Browse files

introduce SCHEMA_AUTHORITY; python 3.9

parent 169d0049
......@@ -13,8 +13,9 @@ class RunEnv(object):
SCHEMA_SERVICE_URL = None
STORAGE_SERVICE_URL = None
DATA_PARTITION = os.environ.get('DATA_PARTITION')
SCHEMA_AUTHORITY = os.environ.get('SCHEMA_AUTHORITY')
OSDU = ['shared-schemas', 'osdu']
LOAD_SEQUENCE = 'load_sequence.0.2.0.json'
LOAD_SEQUENCE = 'load_sequence.1.0.0.json'
def __init__(self):
"""Empty constructor"""
......@@ -152,7 +153,7 @@ class StorageService(object):
url = '{}/schemas/{}'.format(self.url, urllib.parse.quote_plus(kind))
response = requests.request("GET", url, headers=self.headers)
if response.status_code in range(200, 300):
schema = json.loads(response.text, encoding='utf-8')
schema = json.loads(response.text)
else:
messages.append('Error: Storage Service GET schema {}, {}'.format(response.status_code, response.text))
return response.status_code in range(200, 300), schema
......@@ -167,7 +168,7 @@ class StorageService(object):
url += '&cursor={}'.format(cursor)
response = requests.request("GET", url, headers=self.headers)
if response.status_code in range(200, 300):
rs = json.loads(response.text, encoding='utf-8')
rs = json.loads(response.text)
cursor = rs['cursor']
carry_on = len(rs['results']) > 0
for kind in rs['results']:
......@@ -188,7 +189,7 @@ class SchemaService(object):
url = '{}/{}'.format(self.url, kind)
response = requests.request("GET", url, headers=self.headers)
if response.status_code in range(200,300):
schema = json.loads(response.text, encoding='utf-8')
schema = json.loads(response.text)
return response.status_code in range(200,300), schema
def post_or_put_schema(self, kind: str, schema: dict, schema_status: str, messages: list):
......@@ -242,11 +243,9 @@ class SchemaService(object):
response = requests.request("GET", url, headers=self.headers)
schema_infos = list()
if response.status_code in range(200,300):
r = json.loads(response.text, encoding='utf-8')
r = json.loads(response.text)
schema_infos = r['schemaInfos']
for info in schema_infos:
if self.__match(info['schemaIdentity'], si):
return response.status_code in range(200,300), info
return response.status_code in range(200,300), None
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment