tt / components /geo.py
enotkrutoy's picture
Upload 14 files
5e0ca0f verified
raw
history blame contribute delete
448 Bytes
from typing import Any, Optional
import requests
class GeoIPRecon:
def geoip(key: Optional[str], target: str) -> Any:
if key is None:
raise ValueError("KeyNotFound: Key Not Provided")
if target is None:
raise ValueError("InvalidTarget: Target Not Provided")
url = f"https://api.ipgeolocation.io/ipgeo?apiKey={key}&ip={target}"
response = requests.get(url)
return response.text