xyizko commited on
Commit
55fcb5a
·
verified ·
1 Parent(s): 0683b43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -5,8 +5,8 @@ import requests
5
  API_URL = "https://dt074px2e9qbh.cloudfront.net/exploit-api.json"
6
  try:
7
  response = requests.get(API_URL)
8
- flagged_addresses = response.json() # Load the JSON data into a list of dictionaries
9
- # Ensure the data is a list of dictionaries (addresses)
10
  if not isinstance(flagged_addresses, list):
11
  flagged_addresses = []
12
  except Exception as e:
@@ -47,8 +47,13 @@ def check_flagged_address(address: str, hf_token: str):
47
  # Check if the address is in the flagged addresses
48
  flagged = False
49
  for entry in flagged_addresses:
50
- if isinstance(entry, dict) and "address" in entry:
51
- # Normalize the flagged address (lowercase) and check for match
 
 
 
 
 
52
  if entry["address"].strip().lower() == normalized_address:
53
  flagged = True
54
  break
 
5
  API_URL = "https://dt074px2e9qbh.cloudfront.net/exploit-api.json"
6
  try:
7
  response = requests.get(API_URL)
8
+ flagged_addresses = response.json() # Load the JSON data into a list of strings or dictionaries
9
+ # Ensure the data is a list of strings or dictionaries (addresses)
10
  if not isinstance(flagged_addresses, list):
11
  flagged_addresses = []
12
  except Exception as e:
 
47
  # Check if the address is in the flagged addresses
48
  flagged = False
49
  for entry in flagged_addresses:
50
+ # Check if entry is a string (address)
51
+ if isinstance(entry, str):
52
+ if entry.strip().lower() == normalized_address:
53
+ flagged = True
54
+ break
55
+ # Check if entry is a dictionary (with "address" key)
56
+ elif isinstance(entry, dict) and "address" in entry:
57
  if entry["address"].strip().lower() == normalized_address:
58
  flagged = True
59
  break