Skip to content

Commit

Permalink
Update preview explorer url and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
saratomaz committed Jan 30, 2025
1 parent 503e982 commit 832ba90
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sync_tests/utils/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
TESTNET_EXPLORER_URL = "https://explorer.cardano-testnet.iohkdev.io/graphql"
SHELLEY_QA_EXPLORER_URL = "https://explorer.shelley-qa.dev.cardano.org/graphql"
PREPROD_EXPLORER_URL = None
PREVIEW_EXPLORER_URL = None
PREVIEW_EXPLORER_URL = "https://preview.koios.rest/api/v1/epoch_info?_epoch_no="

EXPLORER_URLS = {
"mainnet": MAINNET_EXPLORER_URL,
Expand Down Expand Up @@ -60,6 +60,9 @@ def get_epoch_start_datetime_from_explorer(env: str, epoch_no: int) -> str | Non
)
return None

if env == "preview":
url = f"{url}{epoch_no}"

result = None
try:
response = requests.post(url, data=payload, headers=headers)
Expand All @@ -71,6 +74,8 @@ def get_epoch_start_datetime_from_explorer(env: str, epoch_no: int) -> str | Non
"!!! ERROR: status_code != 200 when getting start time for "
f"epoch {epoch_no} on {env}"
)
elif env == "preview":
result = response.json()[0]["start_time"]
else:
count = 0
while "data" in response.json() and response.json().get("data") is None:
Expand Down

0 comments on commit 832ba90

Please sign in to comment.