@@ -95,7 +95,7 @@ def authenticate_with_password(self, username, password,
9595 security_question_id ,
9696 security_question_answer )
9797 self .auth = TokenAuthentication (res ['userId' ], res ['hash' ])
98- return ( res ['userId' ], res ['hash' ])
98+ return res ['userId' ], res ['hash' ]
9999
100100 def __getitem__ (self , name ):
101101 """ Get a SoftLayer Service.
@@ -116,8 +116,8 @@ def call(self, service, method, *args, **kwargs):
116116
117117 :param service: the name of the SoftLayer API service
118118 :param method: the method to call on the service
119- :param \*args: same optional arguments that ``Service.call`` takes
120- :param \* \*kwargs: same optional keyword arguments that
119+ :param \\ *args: same optional arguments that ``Service.call`` takes
120+ :param \\ * \ \ *kwargs: same optional keyword arguments that
121121 ``Service.call`` takes
122122
123123 :param service: the name of the SoftLayer API service
@@ -140,44 +140,38 @@ def call(self, service, method, *args, **kwargs):
140140 if not service .startswith (self ._prefix ):
141141 service = self ._prefix + service
142142
143- objectid = kwargs .get ('id' )
144- objectmask = kwargs .get ('mask' )
145- objectfilter = kwargs .get ('filter' )
146143 headers = kwargs .get ('headers' , {})
147- compress = kwargs .get ('compress' , True )
148- raw_headers = kwargs .get ('raw_headers' )
149- limit = kwargs .get ('limit' )
150- offset = kwargs .get ('offset' , 0 )
151144
152145 if self .auth :
153146 headers .update (self .auth .get_headers ())
154147
155- if objectid is not None :
156- headers [service + 'InitParameters' ] = {'id' : objectid }
148+ if kwargs . get ( 'id' ) is not None :
149+ headers [service + 'InitParameters' ] = {'id' : kwargs . get ( 'id' ) }
157150
158- if objectmask is not None :
159- headers .update (self .__format_object_mask (objectmask , service ))
151+ if kwargs .get ('mask' ) is not None :
152+ headers .update (self .__format_object_mask (kwargs .get ('mask' ),
153+ service ))
160154
161- if objectfilter is not None :
162- headers ['%sObjectFilter' % service ] = objectfilter
155+ if kwargs . get ( 'filter' ) is not None :
156+ headers ['%sObjectFilter' % service ] = kwargs . get ( 'filter' )
163157
164- if limit :
158+ if kwargs . get ( ' limit' ) :
165159 headers ['resultLimit' ] = {
166- 'limit' : limit ,
167- 'offset' : offset ,
160+ 'limit' : kwargs . get ( ' limit' ) ,
161+ 'offset' : kwargs . get ( ' offset' , 0 ) ,
168162 }
169163
170164 http_headers = {
171165 'User-Agent' : USER_AGENT ,
172166 'Content-Type' : 'application/xml' ,
173167 }
174168
175- if compress :
169+ if kwargs . get ( ' compress' , True ) :
176170 http_headers ['Accept' ] = '*/*'
177171 http_headers ['Accept-Encoding' ] = 'gzip, deflate, compress'
178172
179- if raw_headers :
180- http_headers .update (raw_headers )
173+ if kwargs . get ( ' raw_headers' ) :
174+ http_headers .update (kwargs . get ( ' raw_headers' ) )
181175
182176 uri = '/' .join ([self .endpoint_url , service ])
183177 return make_xml_rpc_api_call (uri , method , args ,
@@ -195,8 +189,8 @@ def iter_call(self, service, method,
195189 :param service: the name of the SoftLayer API service
196190 :param method: the method to call on the service
197191 :param integer chunk: result size for each API call
198- :param \*args: same optional arguments that ``Service.call`` takes
199- :param \* \*kwargs: same optional keyword arguments that
192+ :param \\ *args: same optional arguments that ``Service.call`` takes
193+ :param \\ * \ \ *kwargs: same optional keyword arguments that
200194 ``Service.call`` takes
201195
202196 """
@@ -302,6 +296,11 @@ def get_last_calls(self):
302296
303297
304298class Service (object ):
299+ """ A SoftLayer Service.
300+ :param client: A SoftLayer.API.Client instance
301+ :param name str: The service name
302+
303+ """
305304 def __init__ (self , client , name ):
306305 self .client = client
307306 self .name = name
@@ -310,7 +309,7 @@ def call(self, name, *args, **kwargs):
310309 """ Make a SoftLayer API call
311310
312311 :param method: the method to call on the service
313- :param \*args: (optional) arguments for the remote call
312+ :param \\ *args: (optional) arguments for the remote call
314313 :param id: (optional) id for the resource
315314 :param mask: (optional) object mask
316315 :param dict filter: (optional) filter dict
@@ -338,8 +337,8 @@ def iter_call(self, name, *args, **kwargs):
338337
339338 :param method: the method to call on the service
340339 :param integer chunk: result size for each API call
341- :param \*args: same optional arguments that ``Service.call`` takes
342- :param \* \*kwargs: same optional keyword arguments that
340+ :param \\ *args: same optional arguments that ``Service.call`` takes
341+ :param \\ * \ \ *kwargs: same optional keyword arguments that
343342 ``Service.call`` takes
344343
345344 Usage:
@@ -360,6 +359,7 @@ def __getattr__(self, name):
360359 raise AttributeError ("'Obj' object has no attribute '%s'" % name )
361360
362361 def call_handler (* args , ** kwargs ):
362+ " Handler that actually makes the API call "
363363 return self (name , * args , ** kwargs )
364364 return call_handler
365365
0 commit comments