Skip to content

Commit

Permalink
feat!: update code to work with updated pi backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Asgmel03 committed Sep 5, 2024
1 parent 2a6a794 commit f1ea122
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tagreader/web_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_auth_pi() -> HTTPKerberosAuth:


def get_url_pi() -> str:
return r"https://piwebapi.equinor.com/piwebapi"
return r"https://piwebapi-qa.equinor.com/piwebapi"


def get_auth_aspen(use_internal: bool = True):
Expand Down Expand Up @@ -207,7 +207,8 @@ def connect(self):
) from None

@abstractmethod
def verify_connection(self, datasource: str): ...
def verify_connection(self, datasource: str):
...


class AspenHandlerWeb(BaseHandlerWeb):
Expand Down Expand Up @@ -753,10 +754,7 @@ def generate_search_query(
if desc is not None:
q.extend([f"description:{PIHandlerWeb.escape(desc)}"])
query = " AND ".join(q)
params = {"q": f"{query}"}

if datasource is not None:
params["scope"] = f"pi:{datasource}"
params = {"query": f"{query}"}

return params

Expand Down Expand Up @@ -869,7 +867,8 @@ def search(
params = self.generate_search_query(
tag=tag, desc=desc, datasource=self.datasource
)
url = urljoin(self.base_url, "search", "query")
params["dataserverwebid"] = "F1DSSMXA2c8_LEGIpxNsVfBf1gSlNWVA"
url = urljoin(self.base_url, "points", "search")
done = False
ret = []
while not done:
Expand Down Expand Up @@ -925,8 +924,8 @@ def tag_to_web_id(self, tag: str) -> Optional[str]:
params = self.generate_search_query(
tag=tag, datasource=self.datasource, desc=None
)
params["fields"] = "name;webid"
url = urljoin(self.base_url, "search", "query")
params["dataserverwebid"] = "F1DSSMXA2c8_LEGIpxNsVfBf1gSlNWVA"
url = urljoin(self.base_url, "points", "search")
data = self.fetch(url, params=params)

if len(data["Errors"]) > 0:
Expand Down

0 comments on commit f1ea122

Please sign in to comment.