斗穀於菟 2022-07-27 15:49 采纳率: 0%
浏览 112

github actions 运行Python post 连接超时

在github actions 中运行Python代码时总是连接超时

img


源代码为:

img

# -*- 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)

我该怎么办?

  • 写回答

2条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-21 17:02
    关注
    评论

报告相同问题?

问题事件

  • 修改了问题 7月30日
  • 修改了问题 7月30日
  • 创建了问题 7月27日

悬赏问题

  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能
  • ¥15 io.jsonwebtoken.security.Keys
  • ¥15 急,ubuntu安装后no caching mode page found等
  • ¥15 联想交换机NE2580O/NE1064TO安装SONIC