Skip to content

fixes issue #928 #933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions ip_tracker/ipgeo.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import requests
import http.client
import json
import sys


def main():
url = "http://ip-api.com/json/"
url = "ip-api.com"
address = ""
if len(sys.argv) > 1:
# getting address from command line.
address = ''.join(sys.argv[1:])
url += address

response = requests.request("GET", url)
response = response.json()
conn = http.client.HTTPConnection(url)
conn.request("GET", f"/json/{address}")
res = conn.getresponse()
data = res.read().decode("utf-8")
# final response in JSON format
response = json.loads(data)

if response['status'] == 'fail':
sys.exit(f'''
Expand Down
5 changes: 2 additions & 3 deletions ip_tracker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ IPGeo is a Python Scrpit for Fast, accurate IP Geolocation search.
$python3 ipgeo.py # uses current ip address
```

### Library required
`requests`

### API used
https://ip-api.com/ free API, no API key required.
https://ip-api.com/ free API, no API key required.
1 change: 0 additions & 1 deletion ip_tracker/requirements.txt

This file was deleted.