From 6081b4485dfd6f0a0dce38b17c30c6cef122ef97 Mon Sep 17 00:00:00 2001 From: "ssw@internet2.edu" Date: Tue, 10 Jan 2023 14:53:23 -0500 Subject: [PATCH] fixed type checking --- main.py | 8 ++++---- templates/index.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 41141d8..b26d01f 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,7 @@ def get_asn_from_as(asn): # Remove the "AS" from the beginning of the ASN if asn.startswith("AS") or asn.startswith("as"): asn = asn[2:] + asn = int(asn) return asn def get_more_specifics(data): """ @@ -90,11 +91,10 @@ def is_valid_prefix(prefix): return False def is_valid_asn(asn): - # Check if the ASN is a string starting with "AS", followed by numbers - if re.match(r'^[Aa][Ss]\d+$', asn): + # Check if the ASN is a string starting with "AS", followed by numbers or just a number + if type(asn) is int: return True - # Check if the ASN is just numbers - elif asn.isdigit(): + if re.match(r'^[Aa][Ss]\d+$', asn): return True else: return False diff --git a/templates/index.html b/templates/index.html index 1f7647e..c5a8894 100644 --- a/templates/index.html +++ b/templates/index.html @@ -43,7 +43,7 @@

This app queries the stat.ripe.net to determine if a RPKI-ROA created with the following information
would likely agree (i.e., not evaluate as invalid) for routes currently seen in the Internet

-
> +