Comments (6)
verify 是用于验证支付宝的消息通知。可以贴出报错的栈吗? 暂时没有头绪
from alipay.
127.0.0.1 - - [02/Aug/2018 10:17:41] "POST / HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1997, in call
return self.wsgi_app(environ, start_response)
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/PROJECT/aripayExample/main.py", line 36, in hello_world
success = alipay.verify(data, signature)
AttributeError: module 'alipay' has no attribute 'verify'
有劳!
from alipay.
在verify前执行两行代码
print(type(alipay))
print(alipay.__dict__)
success = alipay.verify(data, signature)
我有点怀疑你用的不是我的库
from alipay.
<class 'module'>
{'AliPayValidationError': <class 'alipay.exceptions.AliPayValidationError'>, 'name': 'alipay', 'AliPayException': <class 'alipay.exceptions.AliPayException'>, 'encodebytes': <function encodebytes at 0x7f08979351e0>, 'datetime': <class 'datetime.datetime'>, 'PKCS1_v1_5': <module 'Cryptodome.Signature.PKCS1_v1_5' from '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/Cryptodome/Signature/PKCS1_v1_5.py'>, 'decodebytes': <function decodebytes at 0x7f08979352f0>, 'spec': ModuleSpec(name='alipay', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f0894b9c048>, origin='/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/alipay/init.py', submodule_search_locations=['/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/alipay']), 'SHA256': <module 'Cryptodome.Hash.SHA256' from '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/Cryptodome/Hash/SHA256.py'>, 'RSA': <module 'Cryptodome.PublicKey.RSA' from '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/Cryptodome/PublicKey/RSA.py'>, 'loader': <_frozen_importlib_external.SourceFileLoader object at 0x7f0894b9c048>, 'ISVAliPay': <class 'alipay.ISVAliPay'>, 'b': <function b at 0x7f089207fa60>, 'package': 'alipay', 'cached': '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/alipay/pycache/init.cpython-35.pyc', 'path': ['/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/alipay'], 'exceptions': <module 'alipay.exceptions' from '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/alipay/exceptions.py'>, 'quote_plus': <function quote_plus at 0x7f089a39a620>, 'doc': '\n init.py\n ~~~~~~~~~~\n\n', 'BaseAliPay': <class 'alipay.BaseAliPay'>, 'compat': <module 'alipay.compat' from '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/alipay/compat.py'>, 'file': '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/alipay/init.py', 'json': <module 'json' from '/usr/lib64/python3.5/json/init.py'>, 'AliPay': <class 'alipay.AliPay'>, 'urlopen': <function urlopen at 0x7f08974d7400>, 'builtins': {'NotImplementedError': <class 'NotImplementedError'>, 'float': <class 'float'>, 'name': 'builtins', 'ConnectionError': <class 'ConnectionError'>, 'list': <class 'list'>, 'sorted': , 'enumerate': <class 'enumerate'>, 'PendingDeprecationWarning': <class 'PendingDeprecationWarning'>, 'True': True, 'EOFError': <class 'EOFError'>, 'spec': ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>), 'repr': , 'filter': <class 'filter'>, 'super': <class 'super'>, 'OSError': <class 'OSError'>, 'ReferenceError': <class 'ReferenceError'>, 'TabError': <class 'TabError'>, 'AssertionError': <class 'AssertionError'>, 'range': <class 'range'>, 'SystemError': <class 'SystemError'>, 'ConnectionAbortedError': <class 'ConnectionAbortedError'>, 'copyright': Copyright (c) 2001-2017 Python Software Foundation.
All Rights Reserved.
Copyright (c) 2000 BeOpen.com.
All Rights Reserved.
Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved., 'setattr': , 'ArithmeticError': <class 'ArithmeticError'>, 'AttributeError': <class 'AttributeError'>, 'len': , 'staticmethod': <class 'staticmethod'>, 'bytes': <class 'bytes'>, 'ConnectionResetError': <class 'ConnectionResetError'>, 'UnicodeError': <class 'UnicodeError'>, 'issubclass': , 'KeyError': <class 'KeyError'>, 'NotImplemented': NotImplemented, 'getattr': , 'globals': , 'open': , 'frozenset': <class 'frozenset'>, 'UnicodeEncodeError': <class 'UnicodeEncodeError'>, 'StopIteration': <class 'StopIteration'>, 'type': <class 'type'>, 'locals': , 'OverflowError': <class 'OverflowError'>, 'sum': , 'ZeroDivisionError': <class 'ZeroDivisionError'>, 'ValueError': <class 'ValueError'>, 'debug': True, 'property': <class 'property'>, 'reversed': <class 'reversed'>, 'UserWarning': <class 'UserWarning'>, 'ord': , 'UnicodeWarning': <class 'UnicodeWarning'>, 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
for supporting Python development. See www.python.org for more information., 'RuntimeError': <class 'RuntimeError'>, 'SyntaxWarning': <class 'SyntaxWarning'>, 'ResourceWarning': <class 'ResourceWarning'>, 'DeprecationWarning': <class 'DeprecationWarning'>, 'bytearray': <class 'bytearray'>, 'compile': , 'map': <class 'map'>, 'object': <class 'object'>, 'BufferError': <class 'BufferError'>, 'max': , 'UnicodeTranslateError': <class 'UnicodeTranslateError'>, 'classmethod': <class 'classmethod'>, 'TimeoutError': <class 'TimeoutError'>, 'hex': , 'IndentationError': <class 'IndentationError'>, 'str': <class 'str'>, 'EnvironmentError': <class 'OSError'>, 'BlockingIOError': <class 'BlockingIOError'>, 'callable': , 'StopAsyncIteration': <class 'StopAsyncIteration'>, 'hasattr': , 'id': , 'eval': , 'memoryview': <class 'memoryview'>, 'pow': , 'iter': , 'int': <class 'int'>, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'all': , 'FileNotFoundError': <class 'FileNotFoundError'>, 'ImportWarning': <class 'ImportWarning'>, 'IsADirectoryError': <class 'IsADirectoryError'>, 'import': , 'UnboundLocalError': <class 'UnboundLocalError'>, 'divmod': , 'dir': , 'IOError': <class 'OSError'>, 'Exception': <class 'Exception'>, 'NotADirectoryError': <class 'NotADirectoryError'>, 'license': See http://www.python.org/3.5/license.html, 'LookupError': <class 'LookupError'>, 'abs': , 'loader': <class '_frozen_importlib.BuiltinImporter'>, 'hash': , 'BaseException': <class 'BaseException'>, 'False': False, 'set': <class 'set'>, 'build_class': , 'ChildProcessError': <class 'ChildProcessError'>, 'package': '', 'NameError': <class 'NameError'>, 'RuntimeWarning': <class 'RuntimeWarning'>, 'dict': <class 'dict'>, 'doc': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the nil' object; Ellipsis represents
...' in slices.", 'UnicodeDecodeError': <class 'UnicodeDecodeError'>, 'InterruptedError': <class 'InterruptedError'>, 'SyntaxError': <class 'SyntaxError'>, 'next': , 'BytesWarning': <class 'BytesWarning'>, 'complex': <class 'complex'>, 'oct': , 'FileExistsError': <class 'FileExistsError'>, 'RecursionError': <class 'RecursionError'>, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'ImportError': <class 'ImportError'>, 'zip': <class 'zip'>, 'any': , 'MemoryError': <class 'MemoryError'>, 'IndexError': <class 'IndexError'>, 'ProcessLookupError': <class 'ProcessLookupError'>, 'FutureWarning': <class 'FutureWarning'>, 'input': , 'ascii': , 'KeyboardInterrupt': <class 'KeyboardInterrupt'>, 'None': None, 'help': Type help() for interactive help, or help(object) for help about object., 'delattr': , 'vars': , 'print': , 'slice': <class 'slice'>, 'FloatingPointError': <class 'FloatingPointError'>, 'tuple': <class 'tuple'>, 'ConnectionRefusedError': <class 'ConnectionRefusedError'>, 'bin': , 'min': , 'GeneratorExit': <class 'GeneratorExit'>, 'bool': <class 'bool'>, 'PermissionError': <class 'PermissionError'>, 'Ellipsis': Ellipsis, 'TypeError': <class 'TypeError'>, 'SystemExit': <class 'SystemExit'>, 'exec': , 'round': , 'BrokenPipeError': <class 'BrokenPipeError'>, 'format': , 'chr': , 'Warning': <class 'Warning'>, 'isinstance': }, 'SHA': <module 'Cryptodome.Hash.SHA' from '/home/PROJECT/code/LibEnv/lib/python3.5/site-packages/Cryptodome/Hash/SHA.py'>}
应该不至于吧,我代码都是从网页上copy的。。。
from alipay.
alipay = Alipay(....)
然后alipay.verify()就好了
你应该是import alipay之后直接使用了
from alipay.
非常感谢,可以用了。之前是我的理解有误。
from alipay.
Related Issues (20)
- 支付宝公钥已经采用证书的形式,没有提供公钥这种形式,需要自己转换?请问有没有好的解放方案么?谢谢 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
- alipay支付网关已经变更了
- notify 回调消息验证失败 binascii.Error: Invalid base64-encoded string HOT 8
- ValueError: nameserver is not an IP address or valid https URL HOT 2
- 沙箱环境下调用失败(invalid-app-id)及其解决办法 HOT 4
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.