推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
kier
V2EX  ›  Python

最近在做微信支付,被一个 urlencode 的问题恶心到了,想问下大家有什么好办法

  •  
  •   kier · May 19, 2014 · 7528 views
    This topic created in 4392 days ago, the information mentioned may be changed or developed.
    微信支付在计算签名时要求对参数进行urlencode,本来用quote_plus可以,但是encode的替换字符都是大写的,比如'http://www.qq.com', encode后是:http%3A%2F%2Fwww.qq.com, 但是微信给的示例文档的结果要求是:http%3a%2f%2fwww.qq.com, 就因为这个不同,导致后面签名的结果不一样,因为是所有参数都要urlenocde,而且有些参数本身是大写的,所以最后统一转小写不太现实,想问下大家有没有什么办法,urlencode用来替换的字符都是小写的?
    8 replies    2015-01-26 10:42:24 +08:00
    spoony
        1
    spoony  
       May 19, 2014
    tolower()?
    spoony
        2
    spoony  
       May 19, 2014
    中间用大小写敏感的加密算法做一次加密。。
    lanceli
        3
    lanceli  
       May 19, 2014
    生成sign的时候转小写就可以了

    package里面该大写还是大写
    123123
        4
    123123  
       May 19, 2014
    最近正好也做了回微信支付,urlencode 之后的确是大写,不过当时也没注意这个问题,也就是说直接用大写的转义字符提交了校验ok。

    原理是微信服务器校验签名签名时需要把 urlencode 之后的 URL 转换成原 URL,所以转义字符的部分就无所谓大小写了。
    123123
        5
    123123  
       May 19, 2014
    所以 LZ 签名校验失败应该不是这里的问题
    kier
        6
    kier  
    OP
       May 19, 2014
    @123123 我现在遇到的问题就是在支付时,弹出提示'系统繁忙,正在升级,请稍后再试', 以及好几天了,都是这个提示。。
    123123
        7
    123123  
       May 19, 2014
    @kier 这个提示没碰上过,直接找微信客服问一下
    wallstreet007
        8
    wallstreet007  
       Jan 26, 2015
    @kier 欢迎使用 Ping++(pingxx.com),支付接入非常简单
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   949 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 60ms · UTC 21:42 · PVG 05:42 · LAX 14:42 · JFK 17:42
    ♥ Do have faith in what you're doing.