TensorGuy01 commited on
Commit
239486c
·
verified ·
1 Parent(s): ed569fb

Create x.py

Browse files
Files changed (1) hide show
  1. x.py +11 -0
x.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ def check_ip_region():
4
+ try:
5
+ ip_info = requests.get("https://ipinfo.io/json", timeout=5).json()
6
+ print(f"Public IP: {ip_info.get('ip')}")
7
+ print(f"Region: {ip_info.get('region')}")
8
+ print(f"Country: {ip_info.get('country')}")
9
+ print(f"City: {ip_info.get('city')}")
10
+ except Exception as e:
11
+ print(f"Failed to get IP info: {e}")