Giter Club home page Giter Club logo

Comments (6)

fzlee avatar fzlee commented on July 19, 2024

verify 是用于验证支付宝的消息通知。可以贴出报错的栈吗? 暂时没有头绪

from alipay.

HengyueLi avatar HengyueLi commented on July 19, 2024

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.

fzlee avatar fzlee commented on July 19, 2024

在verify前执行两行代码

print(type(alipay))
print(alipay.__dict__)
success = alipay.verify(data, signature)

我有点怀疑你用的不是我的库

from alipay.

HengyueLi avatar HengyueLi commented on July 19, 2024

<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.

fzlee avatar fzlee commented on July 19, 2024

alipay = Alipay(....)
然后alipay.verify()就好了

你应该是import alipay之后直接使用了

from alipay.

HengyueLi avatar HengyueLi commented on July 19, 2024

非常感谢,可以用了。之前是我的理解有误。

from alipay.

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.