Pedro Bento commited on
Commit
fe1b54e
·
1 Parent(s): c58e0cd

fix input

Browse files
Files changed (1) hide show
  1. tdagent/tools/query_abuse_ip_db.py +5 -3
tdagent/tools/query_abuse_ip_db.py CHANGED
@@ -121,7 +121,7 @@ def parse_response(response: Dict[str, Any]) -> Tuple[Optional[IPCheckResult], O
121
  return result, None
122
 
123
 
124
- def query_abuseipdb(ip_address: str, api_key: str, days: int) -> str:
125
  """
126
  Main function to query AbuseIPDB and format the response for Gradio
127
 
@@ -133,9 +133,11 @@ def query_abuseipdb(ip_address: str, api_key: str, days: int) -> str:
133
  Returns:
134
  A tuple containing (summary_text, reports_text)
135
  """
136
- if not ip_address or not api_key:
137
  return "Please provide both an IP address and API key"
138
 
 
 
139
  response = check_ip(ip_address, api_key, str(days))
140
  result, error = parse_response(response)
141
 
@@ -147,7 +149,7 @@ def query_abuseipdb(ip_address: str, api_key: str, days: int) -> str:
147
 
148
  gr_query_abuseipdb = gr.Interface(
149
  fn=query_abuseipdb,
150
- inputs=["text", os.environ["ABUSEIPDB_KEY"]],
151
  outputs="string",
152
  title="AbuseIPDB IP Checker",
153
  description="Check if an IP address has been reported for abusive behavior using AbuseIP DB API",
 
121
  return result, None
122
 
123
 
124
+ def query_abuseipdb(ip_address: str, days: int = 30) -> str:
125
  """
126
  Main function to query AbuseIPDB and format the response for Gradio
127
 
 
133
  Returns:
134
  A tuple containing (summary_text, reports_text)
135
  """
136
+ if not ip_address:
137
  return "Please provide both an IP address and API key"
138
 
139
+ api_key = os.environ["ABUSEIPDB_KEY"]
140
+
141
  response = check_ip(ip_address, api_key, str(days))
142
  result, error = parse_response(response)
143
 
 
149
 
150
  gr_query_abuseipdb = gr.Interface(
151
  fn=query_abuseipdb,
152
+ inputs=["text"],
153
  outputs="string",
154
  title="AbuseIPDB IP Checker",
155
  description="Check if an IP address has been reported for abusive behavior using AbuseIP DB API",