feat: add show my ip
This commit is contained in:
15
README.md
15
README.md
@@ -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
12
ShowMyIp.py
Executable 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'])
|
||||||
Reference in New Issue
Block a user