Skip to content

Commit

Permalink
use prod api in case of force refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
mam10eks committed Jan 30, 2025
1 parent 3ae39b9 commit 2bd4e1f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions python-client/tira/rest_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@

import pandas as pd
import requests
from tqdm import tqdm

from tira.check_format import _fmt, check_format
from tira.local_execution_integration import LocalExecutionIntegration
from tira.pandas_integration import PandasIntegration
from tira.profiling_integration import ProfilingIntegration
from tira.pyterrier_integration import (
PyTerrierAnceIntegration,
PyTerrierIntegration,
PyTerrierSpladeIntegration,
)
from tira.pyterrier_integration import PyTerrierAnceIntegration, PyTerrierIntegration, PyTerrierSpladeIntegration
from tira.third_party_integrations import temporary_directory
from tira.tira_redirects import (
RESOURCE_REDIRECTS,
Expand All @@ -32,7 +30,6 @@
mirror_url,
redirects,
)
from tqdm import tqdm

from .tira_client import TiraClient

Expand Down Expand Up @@ -1041,8 +1038,8 @@ def archived_json_response(self, endpoint: str, force_reload: bool = False):
return json.load(open(out, "r"))

out.parent.mkdir(exist_ok=True, parents=True)

response = self.json_response(endpoint, base_url="https://tira.io")
base_url = "https://tira.io" if not force_reload else self.base_url
response = self.json_response(endpoint, base_url=base_url)

with open(out, "w") as f:
f.write(json.dumps(response))
Expand All @@ -1062,7 +1059,7 @@ def json_response(self, endpoint: str, params: Optional[Union[Dict, List[tuple],

for _ in range(self.failsave_retries):
try:
resp = requests.get(url=f"{base_url}{endpoint}", headers=headers, params=params)
resp = requests.get(url=f"{base_url}{endpoint}", headers=headers, verify=self.verify, params=params)
if resp.status_code not in {200, 202}:
raise ValueError(f"Got statuscode {resp.status_code} for {endpoint}. Got {resp}")
else:
Expand Down

0 comments on commit 2bd4e1f

Please sign in to comment.