Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Fix url typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jackshendrikov committed Apr 23, 2021
1 parent a701ee5 commit 8b812bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ip_locator/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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]

Expand Down

0 comments on commit 8b812bb

Please sign in to comment.