File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "format_version" : 1 ,
3- "data_version" : 86 ,
4- "updated" : " 2026-04-08T22:09 :17.767Z " ,
3+ "data_version" : 87 ,
4+ "updated" : " 2026-04-10T13:14 :17.105Z " ,
55 "announcement" : null ,
66 "categories" : [
77 {
14441444 "updated" : null ,
14451445 "status" : " active" ,
14461446 "lines" : 18
1447+ },
1448+ {
1449+ "id" : " get_mnsxghs0" ,
1450+ "name" : " 网页状态政策程序(GET请求)" ,
1451+ "name_en" : " 网页状态政策程序(GET请求)" ,
1452+ "desc" : " 一个侦测网页状态的Python程序(GET请求),小学生通宵做的,不喜勿喷。如有改进,可在电子邮件内提出意见" ,
1453+ "desc_en" : " 一个侦测网页状态的Python程序(GET请求),小学生通宵做的,不喜勿喷。如有改进,可在电子邮件内提出意见" ,
1454+ "category" : " basic" ,
1455+ "file" : " scripts/basic/get_mnsxghs0.py" ,
1456+ "thumbnail" : null ,
1457+ "version" : 1 ,
1458+ "file_type" : " py" ,
1459+ "author" : " 程序员小y" ,
1460+ "author_en" : " 程序员小y" ,
1461+ "tags" : [
1462+ " community"
1463+ ],
1464+ "requires" : [],
1465+ "min_app_version" : " 1.5.0" ,
1466+ "added" : " 2026-04-10" ,
1467+ "updated" : null ,
1468+ "status" : " active" ,
1469+ "lines" : 41
14471470 }
14481471 ]
14491472}
Original file line number Diff line number Diff line change 1+ import urllib3
2+ urllib3 .disable_warnings ()
3+ def menu ():
4+ print ('-' * 20 )
5+ print ('网页侦测程序(GET请求)' )
6+ print ('http状态码含义:' )
7+ print ('1xx:信息,请求收到,继续处理。' )
8+ print ('2xx:成功,请求已成功被服务器接收、理解、并接受' )
9+ print ('3xx:重定向,需要后续操作才能完成这一请求' )
10+ print ('4xx:客户端错误,请求含有语法错误或者无法被执行' )
11+ print ('5xx:服务器错误,服务器在处理某个正确请求时发生错误' )
12+ print ('-' * 20 )
13+
14+ def url ():
15+ name_url = input ('请输入网名:' )
16+ web_url = input ('请输入网址:' )
17+
18+ if not web_url .startswith (('http://' , 'https://' )):
19+ web_url = 'http://' + web_url
20+
21+ try :
22+ http = urllib3 .PoolManager ()
23+ r = http .request ('GET' , web_url , timeout = 5.0 )
24+ print (name_url , '请求状态码:' , r .status )
25+ except Exception as e :
26+ print (f'请求失败: { e } ' )
27+
28+ def main ():
29+ menu ()
30+ while True :
31+ url ()
32+ # 添加退出选项
33+ choice = input ('是否继续检查?(y/n): ' ).lower ()
34+ if choice != 'y' :
35+ print ('程序结束' )
36+ break
37+
38+ if __name__ == "__main__" :
39+ main ()
40+
You can’t perform that action at this time.
0 commit comments