Skip to content

Commit

Permalink
Merge pull request #589 from NASA-IMPACT/add-li-server-creds-to-base-url
Browse files Browse the repository at this point in the history
change li's server access url with authentication
  • Loading branch information
bishwaspraveen authored Feb 7, 2024
2 parents 980fa74 + 2999982 commit 7ee65de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sde_collections/sinequa_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

class Api:
def __init__(self, server_name: str) -> None:
self.server_name = server_name
self.app_name: str = server_configs[server_name]["app_name"]
self.query_name: str = server_configs[server_name]["query_name"]
self.base_url: str = server_configs[server_name]["base_url"]
Expand All @@ -56,7 +57,10 @@ def process_response(self, url: str, payload: dict[str, Any]) -> Any:
return meaningful_response

def query(self, page: int, collection_config_folder: str = "") -> Any:
url = f"{self.base_url}/api/v1/search.query"
if self.server_name == "lis_server":
url = f"{self.base_url}/api/v1/search.query?Password=admin&User=admin"
else:
url = f"{self.base_url}/api/v1/search.query"
payload = {
"app": self.app_name,
"query": {
Expand All @@ -71,7 +75,7 @@ def query(self, page: int, collection_config_folder: str = "") -> Any:
if collection_config_folder:
payload["query"]["advanced"][
"collection"
] = f"/SMD/{collection_config_folder}/"
] = f"/SDE/{collection_config_folder}/"

response = self.process_response(url, payload)

Expand Down

0 comments on commit 7ee65de

Please sign in to comment.