diff --git a/script_library/index.json b/script_library/index.json index 36bcf32..a33c664 100644 --- a/script_library/index.json +++ b/script_library/index.json @@ -1,7 +1,7 @@ { "format_version": 1, - "data_version": 86, - "updated": "2026-04-08T22:09:17.767Z", + "data_version": 87, + "updated": "2026-04-10T13:14:17.105Z", "announcement": null, "categories": [ { @@ -1444,6 +1444,29 @@ "updated": null, "status": "active", "lines": 18 + }, + { + "id": "get_mnsxghs0", + "name": "网页状态政策程序(GET请求)", + "name_en": "网页状态政策程序(GET请求)", + "desc": "一个侦测网页状态的Python程序(GET请求),小学生通宵做的,不喜勿喷。如有改进,可在电子邮件内提出意见", + "desc_en": "一个侦测网页状态的Python程序(GET请求),小学生通宵做的,不喜勿喷。如有改进,可在电子邮件内提出意见", + "category": "basic", + "file": "scripts/basic/get_mnsxghs0.py", + "thumbnail": null, + "version": 1, + "file_type": "py", + "author": "程序员小y", + "author_en": "程序员小y", + "tags": [ + "community" + ], + "requires": [], + "min_app_version": "1.5.0", + "added": "2026-04-10", + "updated": null, + "status": "active", + "lines": 41 } ] } diff --git a/script_library/scripts/basic/get_mnsxghs0.py b/script_library/scripts/basic/get_mnsxghs0.py new file mode 100644 index 0000000..c7448e8 --- /dev/null +++ b/script_library/scripts/basic/get_mnsxghs0.py @@ -0,0 +1,40 @@ +import urllib3 +urllib3.disable_warnings() +def menu(): + print('-'*20) + print('网页侦测程序(GET请求)') + print('http状态码含义:') + print('1xx:信息,请求收到,继续处理。') + print('2xx:成功,请求已成功被服务器接收、理解、并接受') + print('3xx:重定向,需要后续操作才能完成这一请求') + print('4xx:客户端错误,请求含有语法错误或者无法被执行') + print('5xx:服务器错误,服务器在处理某个正确请求时发生错误') + print('-'*20) + +def url(): + name_url = input('请输入网名:') + web_url = input('请输入网址:') + + if not web_url.startswith(('http://', 'https://')): + web_url = 'http://' + web_url + + try: + http = urllib3.PoolManager() + r = http.request('GET', web_url, timeout=5.0) + print(name_url, '请求状态码:', r.status) + except Exception as e: + print(f'请求失败: {e}') + +def main(): + menu() + while True: + url() + # 添加退出选项 + choice = input('是否继续检查?(y/n): ').lower() + if choice != 'y': + print('程序结束') + break + +if __name__ == "__main__": + main() +