From 8b812bb45a0a2a07e18a4488a72b4801a2f5511d Mon Sep 17 00:00:00 2001 From: Jack Shendrikov Date: Fri, 23 Apr 2021 18:38:18 +0300 Subject: [PATCH] Fix url typo --- ip_locator/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ip_locator/views.py b/ip_locator/views.py index e77f1d8..2482053 100644 --- a/ip_locator/views.py +++ b/ip_locator/views.py @@ -17,7 +17,7 @@ def find_ip_address(ip=''): try: response1 = urlopen("http://ipwhois.app/json/" + ip) response2 = urlopen("http://ip-api.com/json/" + ip) - response3 = urlopen("http://api.ipapi.com/" + ip + "?" + API_IP_KEY) + response3 = urlopen("http://api.ipapi.com/" + ip + "?access_key=" + API_IP_KEY) # return JSON with details about IP address return [json.load(response1), json.load(response2), json.load(response3)] @@ -61,6 +61,11 @@ def analyze_api(data_apis): return data_apis[0] else: return data_apis[0] + elif int(float(data_apis[0]['latitude'])) == int(data_apis[2]['latitude']) \ + and int(float(data_apis[0]['longitude'])) == int(data_apis[2]['longitude']): + data_apis[0]['latitude'] = data_apis[2]['latitude'] + data_apis[0]['longitude'] = data_apis[2]['longitude'] + return data_apis[0] elif data_apis[0]['country'] == data_apis[1]['country']: data = data_apis[1]