类型错误: generate_user_key() 缺少 1 个必需的位置参数:'password'



我收到这样的错误

C:UsersvisitorPycharmProjectspastebinhackervenvScriptspython.exe C:/Users/visitor/PycharmProjects/pastebinhacker/pasteb.py
Traceback (most recent call last):
  File "C:/Users/visitor/PycharmProjects/pastebinhacker/pasteb.py", line 5, in <module>
    my_key = PastebinAPI.generate_user_key(api_dev_key,username,paa,)
TypeError: generate_user_key() missing 1 required positional argument: 'password'
Process finished with exit code 1

我阅读了该模块的文档,似乎没问题

from pastebin import PastebinAPI
api_dev_key = '72e257e0475e78c2eed3db0bd68088a8'
username='san1211'
paa='sadasdiuaosd'
my_key = PastebinAPI.generate_user_key(api_dev_key,username,paa,)
print (my_key)

您需要先实例化一个PastebinAPI对象。

然后,您可以使用参数在该对象上调用generate_user_key

例:

from pastebin import PastebinAPI
api_dev_key = '72e257e0475e78c2eed3db0bd68088a8'
username='san1211'
paa='12awweqqwe'
pastbinapi_object = PastebinAPI() # Create your object to work with
my_key = pastbinapi_object.generate_user_key(api_dev_key,username,paa) # Call class method on that object.
print (my_key)

结果:

40ebfabed51dd3179a3f97f37f71c213

相关内容

  • 没有找到相关文章

最新更新