收藏
回答

微信退款时报错 Max retries exceeded with url

requests.exceptions.SSLError: HTTPSConnectionPool(host='api.mch.weixin.qq.com', port=443): Max retries exceeded with url: /secapi/pay/refund (Caused by SSLError(SSLError(336445449, '[SSL] PEM lib (_ssl.c:3401)'),))

请问是什么情况,证书路径已经配置了


MacOS, Python3.6

最后一次编辑于  2020-07-08
回答关注问题邀请回答
收藏

1 个回答

  • 无涯子
    无涯子
    2020-07-08

    Error handling request

    Traceback (most recent call last):

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/urllib3/connectionpool.py", line 677, in urlopen

        chunked=chunked,

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/urllib3/connectionpool.py", line 381, in _make_request

        self._validate_conn(conn)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn

        conn.connect()

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/urllib3/connection.py", line 370, in connect

        ssl_context=context,

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 365, in ssl_wrap_socket

        context.load_cert_chain(certfile, keyfile)

    ssl.SSLError: [SSL] PEM lib (_ssl.c:3401)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/requests/adapters.py", line 449, in send

        timeout=timeout

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/urllib3/connectionpool.py", line 725, in urlopen

        method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/urllib3/util/retry.py", line 439, in increment

        raise MaxRetryError(_pool, url, error or ResponseError(cause))

    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.mch.weixin.qq.com', port=443): Max retries exceeded with url: /secapi/pay/refund (Caused by SSLError(SSLError(336445449, '[SSL] PEM lib (_ssl.c:3401)'),))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 381, in start

        resp = await self._request_handler(request)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/aiohttp/web_app.py", line 310, in _handle

        resp = await handler(request)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl

        return await handler(request)

      File "/Users/wuyazi/italki/mississippi/src/middlewares/error.py", line 11, in middleware_handler

        response = await handler(request)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/aiohttp/web_urldispatcher.py", line 741, in _iter

        resp = await method()

      File "/Users/wuyazi/italki/mississippi/src/common/validate.py", line 31, in wrapper

        return await func(self, *args, **kwargs)

      File "/Users/wuyazi/italki/mississippi/src/apis/refund.py", line 35, in post

        fee_type=params.get('fee_type', 'CNY'))

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/wechatpy/pay/api/refund.py", line 43, in apply

        return self._post('secapi/pay/refund', data=data)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/wechatpy/pay/base.py", line 18, in _post

        return self._client.post(url, **kwargs)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/wechatpy/pay/__init__.py", line 193, in post

        **kwargs

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/wechatpy/pay/__init__.py", line 138, in _request

        **kwargs

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/requests/sessions.py", line 530, in request

        resp = self.send(prep, **send_kwargs)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/requests/sessions.py", line 643, in send

        r = adapter.send(request, **kwargs)

      File "/Users/wuyazi/.local/share/virtualenvs/mississippi-uec03K_7/lib/python3.6/site-packages/requests/adapters.py", line 514, in send

        raise SSLError(e, request=request)

    requests.exceptions.SSLError: HTTPSConnectionPool(host='api.mch.weixin.qq.com', port=443): Max retries exceeded with url: /secapi/pay/refund (Caused by SSLError(SSLError(336445449, '[SSL] PEM lib (_ssl.c:3401)'),))


    2020-07-08
    有用
    回复 3
    • 无涯子
      无涯子
      2020-10-16
      已解决,是证书问题
      2020-10-16
      回复
    • 立
      2021-02-17
      请教下,怎么解决的,我这里也报这个错了
      2021-02-17
      回复
    • 无涯子
      无涯子
      2021-08-23回复
      具体忘记了,好像两个证书都有用
      2021-08-23
      回复
登录 后发表内容
问题标签