mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-01 16:43:08 +01:00
21 lines
428 B
Python
Executable File
21 lines
428 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
"""
|
|
myip - Fetch and display public IP information from ipinfo.io
|
|
"""
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
if __name__ == "__main__":
|
|
KEY_COLOR = "\033[92m"
|
|
END_COLOR = "\033[0m"
|
|
|
|
response = requests.get("https://ipinfo.io", timeout=60)
|
|
json_data = json.loads(response.text)
|
|
|
|
print()
|
|
for item in json_data:
|
|
print(f"- {KEY_COLOR}{item.title():<16}{END_COLOR} {json_data[item]}")
|