Comments (4)
问题的直接原因是python2里面的str类型格式化unicode时出错了。
你可否执行以下逻辑并且附上结果?
import json
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/', methods=["GET", "POST"])
def hello_world():
data = request.form.to_dict()
signature = data.pop("sign")
print(json.dumps(data))
print(signature)
alipay.verify_wap_notify(data, signature)
return 'Hello, World!'
from alipay.
0.6.6已经修复了这个问题,麻烦你帮忙验证一下吧。
from alipay.
你好,出现了新的错误,ValueError: RSA key format is not supported,我使用的是RSA2,按alipay doc的openssl教程生成的rsa_private_key.pem、rsa_public_key.pem 并上传至服务器的/home/alipay_cert/目录下。
alipay_wap = AliPay(appid="2017*********", app_notify_url='http://pay.****.com/alipay/mobile_notify_result/', app_private_key_path="/home/alipay_cert/rsa_private_key.pem", app_alipay_public_key_path="/home/alipay_cert/alipay_public_key_sha256.pem",sign_type="RSA2")
错误如下:
Traceback (most recent call last):
File "/var/www/pay..com/wsgi.py", line 9, in application
return app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/var/www/pay..com/views/merchant.py", line 235, in alipay_mobile_notify_result
success = alipay_wap.verify_wap_notify(data, signature)
File "/usr/local/lib/python2.7/dist-packages/alipay/init.py", line 221, in verify_wap_notify
return self.verify_app_notify(data, signature)
File "/usr/local/lib/python2.7/dist-packages/alipay/init.py", line 218, in verify_app_notify
return self._verify_data(data, signature, self.__app_alipay_public_key_path)
File "/usr/local/lib/python2.7/dist-packages/alipay/init.py", line 248, in _verify_data
return self._verify(message, signature, alipay_public_key_path)
File "/usr/local/lib/python2.7/dist-packages/alipay/init.py", line 229, in _verify
key = RSA.importKey(fp.read())
File "/usr/local/lib/python2.7/dist-packages/Crypto/PublicKey/RSA.py", line 682, in importKey
raise ValueError("RSA key format is not supported")
ValueError: RSA key format is not supported
from alipay.
已搞定
from alipay.
Related Issues (20)
- OpenSSL.crypto.Error: [('PEM routines', 'get_name', 'no start line')] HOT 1
- 3.0接口验证不通过 HOT 2
- OpenSSL.crypto.Error: [('asn1 encoding routines', 'asn1_check_tlen', 'wrong tag'), ('asn1 encoding routines', 'asn1_d2i_ex_primitive', 'nested asn1 error'), ('asn1 encoding routines', 'asn1_template_noexp_d2i', 'nested asn1 error'), ('asn1 encoding routines', 'asn1_template_noexp_d2i', 'nested asn1 error'), ('PEM routines', 'PEM_ASN1_read_bio', 'ASN1 lib')] HOT 5
- RSA key format is not supported HOT 8
- 支付宝公钥已经采用证书的形式,没有提供公钥这种形式,需要自己转换?请问有没有好的解放方案么?谢谢 HOT 3
- 添加支持 alipay.fund.account.query(支付宝资金账户资产查询接口) HOT 2
- alipay.api_alipay_trade_query(out_trade_no=order_id) HOT 4
- uwsgi 无法正常返回 HOT 6
- 验证回调通知错误 HOT 4
- 没有公网ip,怎么样验证支付是否成功 HOT 2
- 能否增加aes支持 HOT 2
- ImportError: cannot import name 'Alipay' from 'alipay'
- 使用支付宝公钥 初始化AliPay时报错 binascii.Error: Incorrect padding HOT 8
- ssl依赖该升级了 HOT 3
- 您好,请问支持分账吗? HOT 11
- 证书方式如何安装 HOT 30
- 是否支持证书方式的签名 HOT 10
- 应用网关是什么 HOT 3
- 3.0如何获取请求返回状态 HOT 10
- 获取用户信息怎么调用 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alipay.