Getting Python TypeError Using linode-python SDK

I'm trying to use Tim Fontaine's linode-python SDK ~~[https://github.com/tjfontaine/linode-python/blob/master/linode/api.py" target="_blank">](https://github.com/tjfontaine/linode-py … ode/api.py">https://github.com/tjfontaine/linode-python/blob/master/linode/api.py]( to manage my Linode servers. However, I'm getting a TypeError I don't understand when I run the linode-disk-list() command.

This is how the linode-python API defines the method I'm calling. As you can see, a LinodeID is required.

@__api_request(required=['LinodeID'],
                 returns=[{u'CREATE_DT': u'YYYY-MM-DD hh:mm:ss.0',
                           u'DISKID': 'Disk ID',
                           u'ISREADONLY': '0 or 1',
                           u'LABEL': 'Disk label',
                           u'LINODEID': 'Linode ID',
                           u'SIZE': 'Size of disk (MB)',
                           u'STATUS': 'Status flag',
                           u'TYPE': "in ['ext3', 'swap', 'raw']",
                           u'UPDATE_DT': u'YYYY-MM-DD hh:mm:ss.0'}])
  def linode_disk_list(self, request):
    """Lists all disk images associated with a Linode."""
    pass

My code creates an instance of the Linode Python API per the SDK's instructions and then calls the linodedisklist method:

from linode import api as linode_api

api = linode_api.Api(<my_api_key>)
linode_id = 1800300
disks = api.linode_disk_list(linode_id)</my_api_key> 

My code generates this error:

TypeError: wrapper() takes exactly 1 argument (2 given)

I know I'm creating the api instance correctly as I'm using it to successfully call the linodeiplist method prior to calling the disk list method.

Just to see what happens, if I don't provide the linode_id argument, I get this error:

linode.api.MissingRequiredArgument: 'LinodeID'

If I call the method with a linode ID, the error says I'm giving it two arguments. But if I don't give it any arguments, it says I'm missing an argument. At this point, I'm not sure if the LinodeID should be an integer or a string but I get the same error in either case. How do I call this method so that I don't get the TypeError argument?

Thanks!

3 Replies

(Ignore annefmoreno; they're a spambot)

Looking at the code, all parameters must be passed as keyword arguments, so your linodedisklist call would look like this:

disks = api.linode_disk_list(LinodeID=1800300)

LinodeID is optional for linodeiplist, and I'm guessing you only have 1 Linode, so the result ends up working fine for you.

@dwfreed:

(Ignore annefmoreno; they're a spambot)

It's hilarious that a bunch of its posts are missing the spammy signature

Thanks dwfreed! Your solution worked.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct