feat: add show my ip

This commit is contained in:
2025-08-27 23:48:14 +08:00
parent 1423102e7e
commit 06f0b20883
2 changed files with 27 additions and 0 deletions

View File

@@ -1,2 +1,17 @@
# python-tests # python-tests
> https://developer.aliyun.com/mirror/pypi/
`~/.pip/pip.conf`
```ini
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
```
```shell
pip install requests
```

12
ShowMyIp.py Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env python3
import requests
IP_ACTION_URL = "https://hatter.ink/ip/ip.jsonp"
if __name__ == "__main__":
response = requests.get(IP_ACTION_URL)
if response.status_code != 200:
print("[ERROR]", response.status_code)
else:
print(response.json())
print("Your IP is:", response.json()['ip'])