File size: 448 Bytes
5e0ca0f
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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