在github actions 中运行Python代码时总是连接超时
源代码为:
# -*- coding: utf-8 -*-
import requests
import ddddocr
import time
session_1 = requests
shi = time.time() * 1000.00
shi = str(int(shi))
session = requests.Session()
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', 'Host': 'xgxlsg.cqbvc.edu.cn:17535', 'Referer': 'http://xgxlsg.cqbvc.edu.cn:17535/SPCP/Web/Account/ChooseType', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0', }
tu_url = 'http://xgxlsg.cqbvc.edu.cn:17535/SPCP/Web/Account/GetLoginVCode?dt=' + shi
panDuan = 3
while panDuan != 4:
c = requests.get(tu_url, headers, timeout=15, verify=False)
c_1 = c.content
with open("daka.png", "wb") as fb:
fb.write(c_1)
# print(c)
ocr = ddddocr.DdddOcr()
with open('daka.png', 'rb') as f:
img_bytes = f.read()
res = ocr.classification(img_bytes)
panDuan = len(res)
print(len(res))
print(res)
我该怎么办?