@@ -116,7 +116,7 @@ def query_single(self, object_type, url_params, query_params=None):
116116 # Server API convention (v2) is that the pluralized object type goes into the endpoint
117117 # but the object type is the key in the response dictionary for the returned object.
118118 query_type = object_type + "s" # poor man's plural
119- query_path = "/{}/{}" .format (query_type , self .org_id )
119+ query_path = "/organizations/ {}/{}" .format (self .org_id , query_type )
120120 for component in url_params if url_params else []:
121121 query_path += "/" + urlparse .quote (component )
122122 if query_params : query_path += "?" + urlparse .urlencode (query_params )
@@ -155,8 +155,16 @@ def query_multiple(self, object_type, page=0, url_params=None, query_params=None
155155 for component in url_params if url_params else []:
156156 query_path += "/" + urlparse .quote (component )
157157 if query_params : query_path += "?" + urlparse .urlencode (query_params )
158- result = self .make_call (query_path )
159- body = result .json ()
158+ try :
159+ result = self .make_call (query_path )
160+ body = result .json ()
161+ except RequestError as re :
162+ if re .result .status_code == 404 :
163+ if self .logger : self .logger .debug ("Ran %s query: %s %s (0 found)" ,
164+ object_type , url_params , query_params )
165+ return [], True
166+ else :
167+ raise re
160168 if body .get ("result" ) == "success" :
161169 values = body .get (query_type , [])
162170 last_page = body .get ("lastPage" , False )
0 commit comments