linode - I don't understand this Python TypeError -
i trying use linode api along linode-python sdk manage linode servers. however, i'm getting typeerror don't understand when run linode-disk-list() command.
this how linode-python api defines method i'm calling. can see, linodeid 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 disk images associated linode.""" pass
my code creates instance of linode python api per sdk's instructions , calls linode_disk_list method:
from linode import api linode_api api = linode_api.api(<my_api_key>) linode_id = 1800300 disks = api.linode_disk_list(linode_id)
my code generates error:
typeerror: wrapper() takes 1 argument (2 given)
i know i'm creating api instance correctly i'm using call linode_ip_list method prior calling disk list method.
just see happens, if don't provide linode_id argument, error:
linode.api.missingrequiredargument: 'linodeid'
if call method linode id, error says i'm giving 2 arguments. if don't give arguments, says i'm missing argument. @ point, i'm not sure if linodeid should integer or string same error in either case. how call method don't typeerror argument?
thanks!
the @__api_request
decorator takes list each of arguments:
def __api_request(required=[], optional=[], returns=[]): """decorator define required , optional parameters""" k in required: [...]
but, passing in integer
linode_id = 1800300 disks = api.linode_disk_list(linode_id)
and getting conflicting error message amount of parameters because wrapper()
method takes arbitrary amount of keyword arguments
def wrapper(self, **kw):
Comments
Post a Comment