From eaada7cf168e0b9622e0e0cadffd6493246595e8 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Thu, 9 Apr 2026 23:59:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20README=20with=20new=20s?= =?UTF-8?q?cript=20example=20and=20usage=20instructions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 2a77806..3f25f45 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,33 @@ pip install cryptography ```shell PYTHONPATH=./.venv/lib/python3.10/site-packages/ ./show_my_ip.py ``` + +
+ +`show_myip.py` +```python +#! /usr/bin/env uv run + +# /// script +# requires-python = ">=3.9" +# dependencies = [ +# "requests>=2.32.5", +# ] +# /// +import requests; + +IP_ACTION_URL = "https://hatter.ink/ip/ip.jsonp" + +if __name__ == "__main__": + response = requests.get(IP_ACTION_URL, timeout=10) + if response.status_code != 200: + print("[ERROR]", response.status_code) + else: + response_json = response.json() + print(response_json) + print("Your IP is:", response_json['ip']) +``` + +```shell +./show_myip.py +```