diff --git a/ipserv.py b/ipserv.py index 117563e..8cba0e7 100644 --- a/ipserv.py +++ b/ipserv.py @@ -59,12 +59,12 @@ async def ip( logging.info("cache expired for %s", ip) logging.info("looking up IP info for %s", ip) - result = await make_request( + data = await make_request( ip, {"User-Agent": User_Agent} ) - if isinstance(result, HTTPException): - return result + if isinstance(data, HTTPException): + return data data["ip"] = ip data.pop("legalese", None) data.pop("source", None) @@ -84,12 +84,12 @@ async def lookup(ip: str = Query(...), User_Agent: str = Header("Mozilla/5.0")): logging.info("cache expired for %s", ip) logging.info("looking up IP info for %s", ip) - result = await make_request( + data = await make_request( ip, {"User-Agent": User_Agent} ) - if isinstance(result, HTTPException): - return result + if isinstance(data, HTTPException): + return data data["ip"] = ip data.pop("legalese", None) data.pop("source", None)