Commit e2fe5e46 authored by Spencer Sutton's avatar Spencer Sutton
Browse files

Updating for backwards comp

parent 10bfa9b0
......@@ -23,18 +23,17 @@ class BaseClient:
Base client that is meant to be extended by service specific clients
"""
def __init__(self, data_partition_id):
def __init__(self, data_partition_id=None):
"""
Base client gets initialized with configuration values and a bearer token
based on provider-specific logic
"""
self._parse_config()
self.data_partition_id = data_partition_id
self._parse_config(data_partition_id)
self.unauth_retries = 0
if self.use_service_principal == 'True' or self.use_service_principal == 'true':
self._refresh_service_principal_token()
def _parse_config(self):
def _parse_config(self, data_partition_id):
"""
Example config file:
[environment]
......@@ -55,6 +54,11 @@ class BaseClient:
if config_file_name not in found_names:
raise Exception('Could not find osdu_api.ini config file')
if data_partition_id is None:
self.data_partition_id = config_parser.get('environment', 'data_partition_id')
else:
self.data_partition_id = data_partition_id
self.storage_url = config_parser.get('environment', 'storage_url')
self.search_url = config_parser.get('environment', 'search_url')
self.data_workflow_url = config_parser.get('environment', 'data_workflow_url')
......
from osdu_api.clients.search.search_client import SearchClient
from osdu_api.model.search.query_request import QueryRequest
search_client = SearchClient("osdu")
query_request = QueryRequest(kind='osdu:wks:*:*', query="*", cursor=None, limit=1000)
search_response = search_client.query_with_cursor(query_request, bearer_token=None)
print(search_response.status_code)
print("________________")
print(search_response.content)
\ No newline at end of file
Supports Markdown
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