Giter Club home page Giter Club logo

Comments (19)

zwczou avatar zwczou commented on September 14, 2024

退款,初始化WeixinPay的时候需要传入key, cert(注意不是pck12格式的)

from weixin-python.

zwczou avatar zwczou commented on September 14, 2024

立面应该有三个证书文件,一个pck12格式的,剩下的两个才是,你可以看看是不是顺序搞错了

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

立面应该有三个证书文件,一个pck12格式的,剩下的两个才是,你可以看看是不是顺序搞错了

image
但是初始化这里不是才两个吗

image
我下载的时候确实有三个文件,但是我一直找不到这个p12文件放哪
image
退款api里面也没看到

image
这是我的初始化的地方

from weixin-python.

zwczou avatar zwczou commented on September 14, 2024

那你这个看起来问题不大,_fetch(url, data, True),第三个参数为True的时候会使用证书,你可以检查下路径python是否有权限了,文件是不是存在, p12就是pcks12

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

那你这个看起来问题不大,_fetch(url, data, True),第三个参数为True的时候会使用证书,你可以检查下路径python是否有权限了,文件是不是存在, p12就是pcks12

我能确定的就是,文件路径正确的,在本地测试的时候,两个pem文件都给了0777的权限,但是按照你上面说的那个有三个证书的,我没找到在哪里引用第三个证书,在官方文档里面我好像也看到了除了PHP以后的都要引用第三个证书的

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

那你这个看起来问题不大,_fetch(url, data, True),第三个参数为True的时候会使用证书,你可以检查下路径python是否有权限了,文件是不是存在, p12就是pcks12

哥,能回一下怎么搞吗?我实在看不到那个证书怎么用呢

from weixin-python.

zwczou avatar zwczou commented on September 14, 2024

你看运行python的那个用户,是否有读取这两个证书的权限

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

你看运行python的那个用户,是否有读取这两个证书的权限
image

这算有权限了吧

from weixin-python.

zwczou avatar zwczou commented on September 14, 2024

我看你这是两个环境呀,一个是本地环境(/Users/....),一个是服务器环境吧(/www/server),本地环境跟服务器环境报错信息都是一样么

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

我看你这是两个环境呀,一个是本地环境(/Users/....),一个是服务器环境吧(/www/server),本地环境跟服务器环境报错信息都是一样么

是的,都是一样的,我就是测了本地报错,才放服务器去测的,但很遗憾,都是统一的错

from weixin-python.

zwczou avatar zwczou commented on September 14, 2024

那可以考虑下证书内容问题,尝试用p12里面重新导出key, cert

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

那可以考虑下证书内容问题,尝试用p12里面重新导出key, cert

我通过这里使用openssl pkcs12 -nodes -clcerts -in wx_apiclient_cert.p12 -out wx_apiclient_key.pem导出新的证书了,然后把公钥和私钥分别复制到对应的文件了,还是报同样的错误,我电脑是mac,难道我要先把p12证书安装到系统里面?

我在想,我服务器上面这个fastapi项目对应的域名用的是DigiCert 免费版 SSL,这个有没有关系呢?不过我看你源代码那里有提交cert的,应该跟我那个没关系的吧?

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

那可以考虑下证书内容问题,尝试用p12里面重新导出key, cert

image
兄弟,我能100%确定是你的库有问题,我自己写的一个退款函数并且成功退款了,而且新生成的证书在你的库那里也是报同样的错,而我这里一步到位,没任何报错,这个issues就关掉了哈,你检查一下你的库吧

from weixin-python.

zhengzhou avatar zhengzhou commented on September 14, 2024

这个问题我也遇到了,不过退款功能已经上线几个月了,之前一直没问题,最近概率性的,应该不是这个库的问题。

requests的说法是如果证书问题会提前出错的,不会等到腾讯那边返回错误的。
image

from weixin-python.

sky-chy avatar sky-chy commented on September 14, 2024

这个问题我也遇到了,不过退款功能已经上线几个月了,之前一直没问题,最近概率性的,应该不是这个库的问题。

requests的说法是如果证书问题会提前出错的,不会等到腾讯那边返回错误的。 image

我很久之前的一个项目也是用这个库的,那时候测过退款也没问题,只是后来上线了用不着了,但是我这第二个项目就没法成功执行退款了,第一个项目是django写的,第二个是fastapi写的

from weixin-python.

zwczou avatar zwczou commented on September 14, 2024

最近几天我抽空来验证下

from weixin-python.

zhengzhou avatar zhengzhou commented on September 14, 2024

更新了一下certifi这个库,应该是哪个版本的证书库不认微信发的证书导致的。所以不同环境下可能出现问题。

from weixin-python.

zwczou avatar zwczou commented on September 14, 2024

更新了一下certifi这个库,应该是哪个版本的证书库不认微信发的证书导致的。所以不同环境下可能出现问题。

能看看你安装的依赖版本么

pip freeze

from weixin-python.

zhengzhou avatar zhengzhou commented on September 14, 2024
aliyun-python-sdk-core==2.13.35
aliyun-python-sdk-kms==2.15.0
amqp==5.0.6
asgiref==3.4.1
billiard==3.6.4.0
celery==5.1.2
certifi==2021.10.8
cffi==1.14.6
charset-normalizer==2.0.4
click==7.1.2
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
crcmod==1.7
cryptography==3.4.7
defusedxml==0.7.1
Django==3.2.6
django-celery-results==2.2.0
django-cors-headers==3.10.0
django-environ==0.4.5
django-filter==2.4.0
django-redis==5.0.0
djangorestframework==3.12.4
djangorestframework-simplejwt==4.7.2
djangorestframework-xml==2.0.0
gunicorn==20.1.0
h11==0.12.0
h2==4.0.0
hpack==4.0.0
Hypercorn==0.11.2
hyperframe==6.0.1
idna==3.2
jmespath==0.10.0
kombu==5.1.0
lxml==4.6.3
mysqlclient==2.0.3
oss2==2.15.0
Pillow==8.3.2
priority==2.0.0
prompt-toolkit==3.0.20
pycparser==2.20
pycryptodome==3.10.1
PyJWT==2.1.0
pytz==2021.1
PyYAML==5.4.1
redis==3.5.3
requests==2.27.1
six==1.16.0
sqlparse==0.4.1
toml==0.10.2
tqdm==4.62.0
uritemplate==3.0.1
urllib3==1.26.6
vine==5.0.0
wcwidth==0.2.5
weixin-python==0.5.7
wsproto==1.0.0

昨天更新了requests到最新的也没用,后面尝试更新一下certifi,结果没问题了。

  • 本地环境没问题: certifi 2020.12.5
  • 服务器问题的版本 certifi 2021.5.30
  • 服务器更新后没问题,版本 certifi 2021.10.8

from weixin-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.