当前位置:论坛首页 > Linux面板 > 求助

【待反馈】使用api调用申请SSL报错404

发表在 Linux面板2024-4-26 17:49 [复制链接] 3 74

为了能快速了解并处理您的问题,请提供以下基础信息
相关截图(日志、错误):

接口:/acme?action=apply_cert_api 创建证书ssl时报错:确定URL是正确的,权限也正常。上下文还有其他的接口调用,都可以正常。就这个接口异常,请帮忙看一下,谢谢报错如下:
Traceback (most recent call last):
  File "create.py", line 196, in <module>
    r_data_.create_ssl = my_api.create_ssl()
  File "create.py", line 94, in create_ssl
    result = self.__http_post_cookie(url,p_data)
  File "create.py", line 175, in __http_post_cookie
    response = opener.open(req,timeout = timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found



使用道具 举报 只看该作者 回复
发表于 2024-4-26 18:15:13 | 显示全部楼层
您好,404一般表示权限问题或者资源未找到
检查一下URL的路径是否正确,能不能正常访问到
查看一下服务器的日志,有没有相关的提示信息
使用道具 举报 回复 支持 反对
发表于 2024-4-26 18:35:09 | 显示全部楼层
url都正常,上下文都有去调用,就这一个接口报404
    #创建ssl
    def create_ssl(self):
        #拼接URL地址
        url = self.__BT_PANEL + '/acme?action=apply_cert_api'
        r_data = self.create_web()
        site_id = r_data.get('siteId')
        #准备POST数据
        p_data = self.__get_key_data()  #取签名
        #p_data['domains'] = [self.global_domain]
        p_data['domains'] = "6603378.com"
        p_data['auth_type'] = 'http'
        p_data['auto_wildcard'] = 0
        p_data['auth_to'] = 52
        p_data['id'] = 52

        print(p_data['domains'])
        print(p_data['auth_type'])
        print(p_data['auto_wildcard'])
        print(p_data['auth_to'])
        print(p_data['id'])


        #请求面板接口
        result = self.__http_post_cookie(url,p_data)

        #解析JSON数据
        response = json.loads(result)
        if not response['msg']:
            raise Exception(f"创建 SSL 失败: {response['msg']}")

        return response
使用道具 举报 回复 支持 反对
发表于 2024-4-26 18:45:34 | 显示全部楼层
创建html静态页面和开启https都可以正常调用api和正常返回
只有申请ssl证书会报这个错误
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

企业版年付运维跟进群

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急问题处理

论坛响应时间:10分钟

问题处理方式:1对1处理(优先)

工作时间:白班:9:00 - 18:00

工作时间:晚班:18:00 - 24:00

立即付费处理
快速回复 返回顶部 返回列表