From a5c0ffc4bab70624dac20c16cb857dacba8ba848 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 3 Jan 2024 02:05:48 +1100 Subject: [PATCH] fix: Stop crash with domain without DNS --- domainLookup.py | 11 +++++++---- main.py | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/domainLookup.py b/domainLookup.py index b72b2a7..d04aeb0 100644 --- a/domainLookup.py +++ b/domainLookup.py @@ -143,15 +143,18 @@ def niami_info(domain: str): response = response.json() if response["data"]["owner_tx_data"] is not None: output = { - "owner": response["data"]["owner_tx_data"]["address"], - "dns": response["data"]["dnsData"] + "owner": response["data"]["owner_tx_data"]["address"] } else: output = { - "owner": None, - "dns": [] + "owner": None } + if 'dnsData' in response["data"]: + output["dns"] = response["data"]["dnsData"] + else: + output["dns"] = [] + transactions = requests.get(f"https://api.niami.io/txs/{domain}") if transactions.status_code != 200: return False diff --git a/main.py b/main.py index 002f72e..1b9959c 100644 --- a/main.py +++ b/main.py @@ -396,9 +396,9 @@ def bid(domain): bid = request.args.get("bid") blind = request.args.get("blind") - if bid is "": + if bid == "": bid = 0 - if blind is "": + if blind == "": blind = 0 if bid+blind == 0: