remote_addr -> access_route[-1]

This commit is contained in:
Parker M. 2024-02-25 02:45:45 -06:00
parent 0ea4abca33
commit c7b28e4d7f
No known key found for this signature in database
GPG Key ID: 95CD2E0C7E329F2A

View File

@ -50,7 +50,7 @@ def log(link, request):
if ip_to_location == 'TRUE':
# Get IP to GEO via IP2Location.io
try:
data = ipgeolocation.lookup(request.remote_addr)
data = ipgeolocation.lookup(request.access_route[-1])
location = f'{data["country_name"]}, {data["city_name"]}'
isp = data['as']
# Fatal error, API key is invalid or out of requests, quit
@ -63,7 +63,7 @@ def log(link, request):
isp = '-'
timestamp = datetime.datetime.now()
ip = request.remote_addr
ip = request.access_route[-1]
user_agent = request.user_agent.string
ua_string = user_agent_parser.Parse(user_agent)
browser = ua_string['user_agent']['family']