您现在的位置是: 网站首页> 学习笔记> Django Django
django接入支付宝支付抛异常request sign failed. int() argument must be a string, a bytes-like object or a real number, not 'Sequence'
2024-08-02 [django] 245人已围观
在django项目中接入支付宝支付,使用alipay-sdk-python模块, 所有参数按官方文档设置好并调用,抛如下异常:
Traceback (most recent call last): File "D:\pyvenv\orderingshop\lib\site-packages\alipay\aop\api\DefaultAlipayClient.py", line 127, in __prepare_request_params sign = sign_with_rsa2(self.__config.app_private_key, sign_content, self.__config.charset) File "D:\pyvenv\orderingshop\lib\site-packages\alipay\aop\api\util\SignatureUtils.py", line 49, in sign_with_rsa2 signature = rsa.sign(sign_content, rsa.PrivateKey.load_pkcs1(private_key, format='PEM'), 'SHA-256') File "D:\pyvenv\orderingshop\lib\site-packages\rsa\key.py", line 125, in load_pkcs1 return method(keyfile) File "D:\pyvenv\orderingshop\lib\site-packages\rsa\key.py", line 613, in _load_pkcs1_pem return cls._load_pkcs1_der(der) File "D:\pyvenv\orderingshop\lib\site-packages\rsa\key.py", line 548, in _load_pkcs1_der key = cls(as_ints) TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Sequence' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\pyvenv\orderingshop\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "D:\pyvenv\orderingshop\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, callback_args, callback_kwargs) File "D:\pyvenv\orderingshop\lib\site-packages\django\views\decorators\csrf.py", line 56, in wrapper_view return view_func(*args, kwargs) File "D:\pyvenv\orderingshop\lib\site-packages\django\views\generic\base.py", line 104, in view return self.dispatch(request, args, kwargs) File "D:\pyvenv\orderingshop\lib\site-packages\rest_framework\views.py", line 509, in dispatch response = self.handle_exception(exc) File "D:\pyvenv\orderingshop\lib\site-packages\rest_framework\views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "D:\pyvenv\orderingshop\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception raise exc File "D:\pyvenv\orderingshop\lib\site-packages\rest_framework\views.py", line 506, in dispatch response = handler(request, args, **kwargs) File "D:\codes\zzc\orderingshop\pay\views.py", line 74, in post response = self.get_alipay_client().page_execute(request) File "D:\pyvenv\orderingshop\lib\site-packages\alipay\aop\api\DefaultAlipayClient.py", line 322, in page_execute query_string, params = self.__prepare_request(request) File "D:\pyvenv\orderingshop\lib\site-packages\alipay\aop\api\DefaultAlipayClient.py", line 89, in __prepare_request common_params, params = self.__prepare_request_params(request) File "D:\pyvenv\orderingshop\lib\site-packages\alipay\aop\api\DefaultAlipayClient.py", line 131, in __prepare_request_params raise RequestException('[' + THREAD_LOCAL.uuid + ']request sign failed. ' + str(e)) alipay.aop.api.exception.Exception.RequestException: [d6c2b210-50c3-11ef-90c5-005056c00008]request sign failed. int() argument must be a string, a bytes-like object or a real number, not 'Sequence'
抛异常原因:
使用支付宝官方开放平台密钥工具V2.0.3生成的应用私钥格式不正确;
解决方法:
需要用该工具再转换一次。
相关文章
- django在执行migrate时抛异常:django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'auth_group'")
- django接入支付宝支付抛异常request sign failed. int() argument must be a string, a bytes-like object or a real number, not 'Sequence'
- django使用自定义存储类上传图片到阿里OSS,makemigrations时报异常
- django admin使用自定义用户类以后,新增用户保存的密码为明文
文章评论
暂无评论添加评论
点击排行
本栏推荐
标签云
热评文章
- django使用qq邮箱发送邮件
- mysql8设置数据库远程连接
- pip修改下载源为国内源
- win10看不到win7共享的文件夹的解决方法
- SQLyog连接 Mysql 8.0.11 报error no.1251- Client does not support authentic...
- 使用Oracel Net Nanager配置Oracle数据库远程访问
- 将anaconda的下载源切换为国内的源
- Python+selenium+firefox设置代理IP
- selenium+firefox+js实现动态设置firefox浏览器代理IP
- scrapy文件下载(高新技术企业认定网)
- Python调用JS代码
- Chrome浏览器的overrides的使用
站点信息
- 建站时间:2021-01-01
- 网站程序:Django 3.1.2
- 文章统计:53篇
- 文章评论:31条
- 统计数据: