The TypeError
has nothing to do with your definition, but with your call:
ids = MyApi.GetFollowerIDs(
screen_name=options['username'],
cursor=cursor,
count=options['batch-size'],
total_count=options['total'],
)
GetFollowerIDs
is an instance method—that's why it takes a self
parameter. So you have to call it on an instance of the class, not the class itself.
The API documentation samples show how to properly create and use an instance of twitter.API
; you'll do the exact same thing, except to create and use an instance of MyApi
instead.
You also may want to read the tutorial on Classes, or some third-party tutorial, if this isn't obvious once pointed out.
Meanwhile, within the method, you're calling the base class properly via super
… but that isn't going to let you access local variables from the base class method. Local variables are local; they only live while the method is running. So, after the base class method returns, they don't even exist anymore.
The reason your IDE is saying they aren't defined is that they really aren't defined, except within the implementation of that method.
If you really need to access the internal state of the method's implementation, the only reasonable workaround would be to copy that method's implementation to your code, instead of calling the method.