@@ -99,12 +99,7 @@ def __init__(self, items, total_count):
9999
100100class XmlRpcTransport (object ):
101101 """XML-RPC transport."""
102- def __init__ (self ,
103- endpoint_url = None ,
104- timeout = None ,
105- proxy = None ,
106- user_agent = None ,
107- verify = True ):
102+ def __init__ (self , endpoint_url = None , timeout = None , proxy = None , user_agent = None , verify = True ):
108103
109104 self .endpoint_url = (endpoint_url or
110105 consts .API_PUBLIC_ENDPOINT ).rstrip ('/' )
@@ -202,19 +197,13 @@ def __call__(self, request):
202197class RestTransport (object ):
203198 """REST transport.
204199
205- Currently only supports GET requests (no POST, PUT, DELETE) and lacks
206- support for masks, filters, limits and offsets.
200+ REST calls should mostly work, but is not fully tested.
201+ XML-RPC should be used when in doubt
207202 """
208203
209- def __init__ (self ,
210- endpoint_url = None ,
211- timeout = None ,
212- proxy = None ,
213- user_agent = None ,
214- verify = True ):
204+ def __init__ (self , endpoint_url = None , timeout = None , proxy = None , user_agent = None , verify = True ):
215205
216- self .endpoint_url = (endpoint_url or
217- consts .API_PUBLIC_ENDPOINT_REST ).rstrip ('/' )
206+ self .endpoint_url = (endpoint_url or consts .API_PUBLIC_ENDPOINT_REST ).rstrip ('/' )
218207 self .timeout = timeout or None
219208 self .proxy = proxy
220209 self .user_agent = user_agent or consts .USER_AGENT
@@ -223,12 +212,12 @@ def __init__(self,
223212 def __call__ (self , request ):
224213 """Makes a SoftLayer API call against the REST endpoint.
225214
226- This currently only works with GET requests
215+ REST calls should mostly work, but is not fully tested.
216+ XML-RPC should be used when in doubt
227217
228218 :param request request: Request object
229219 """
230- request .transport_headers .setdefault ('Content-Type' ,
231- 'application/json' )
220+ request .transport_headers .setdefault ('Content-Type' , 'application/json' )
232221 request .transport_headers .setdefault ('User-Agent' , self .user_agent )
233222
234223 params = request .headers .copy ()
@@ -252,9 +241,8 @@ def __call__(self, request):
252241 )
253242
254243 method = REST_SPECIAL_METHODS .get (request .method )
255- is_special_method = True
244+
256245 if method is None :
257- is_special_method = False
258246 method = 'GET'
259247
260248 body = {}
@@ -272,9 +260,7 @@ def __call__(self, request):
272260 if request .identifier is not None :
273261 url_parts .append (str (request .identifier ))
274262
275- # Special methods (createObject, editObject, etc) use the HTTP verb
276- # to determine the action on the resource
277- if request .method is not None and not is_special_method :
263+ if request .method is not None :
278264 url_parts .append (request .method )
279265
280266 url = '%s.%s' % ('/' .join (url_parts ), 'json' )
0 commit comments