diff --git a/README.md b/README.md index 5d73267..e1b38cb 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # 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 +``` + diff --git a/ShowMyIp.py b/ShowMyIp.py new file mode 100755 index 0000000..26c5f98 --- /dev/null +++ b/ShowMyIp.py @@ -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'])