pythonpastebin

TypeError: generate_user_key() missing 1 required positional argument: 'password'


i am getting such error

C:\Users\visitor\PycharmProjects\pastebinhacker\venv\Scripts\python.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

I read the documentation of that Module and it seems all right

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)

Solution

  • You need to instantiate a PastebinAPI object first.

    Then you can call generate_user_key on that object with your parameter.

    Example:

    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)
    

    Result:

    40ebfabed51dd3179a3f97f37f71c213