3030import six .moves .urllib .parse as urlparse
3131
3232from .auth import JWT , Auth , AccessRequest
33- from .error import BatchError , UnavailableError , ClientError , RequestError , ServerError
33+ from .error import BatchError , UnavailableError , ClientError , RequestError , ServerError , ArgumentError
3434from .version import __version__ as umapi_version
3535
3636
@@ -119,7 +119,7 @@ def __init__(self,
119119 elif auth_dict :
120120 self .auth = self ._get_auth (ims_host = ims_host , ims_endpoint_jwt = ims_endpoint_jwt , ** auth_dict )
121121 else :
122- raise ValueError ("Connector create: either auth (an Auth object) or auth_dict (a dictionary ) is required" )
122+ raise ArgumentError ("Connector create: either auth (an Auth object) or auth_dict (a dict ) is required" )
123123 self .session = requests .Session ()
124124 ua_string = "umapi-client/" + umapi_version + " Python/" + python_version () + " (" + platform_version () + ")"
125125 if user_agent and user_agent .strip ():
@@ -133,7 +133,7 @@ def _get_auth(self, ims_host, ims_endpoint_jwt,
133133 tech_acct_id = tech_acct_id or kwargs .get ("tech_acct" )
134134 private_key_file = private_key_file or kwargs .get ("priv_key_path" )
135135 if not (tech_acct_id and api_key and client_secret and (private_key_data or private_key_file )):
136- raise ValueError ("Connector create: not all required auth parameters were supplied; please see docs" )
136+ raise ArgumentError ("Connector create: not all required auth parameters were supplied; please see docs" )
137137 if private_key_data :
138138 jwt = JWT (self .org_id , tech_acct_id , ims_host , api_key , six .StringIO (private_key_data ))
139139 else :
@@ -196,7 +196,7 @@ def query_single(self, object_type, url_params, query_params=None):
196196 query_type = object_type + "s" # poor man's plural
197197 query_path = "/organizations/{}/{}" .format (self .org_id , query_type )
198198 for component in url_params if url_params else []:
199- query_path += "/" + urlparse .quote (component )
199+ query_path += "/" + urlparse .quote (component , safe = '/@' )
200200 if query_params : query_path += "?" + urlparse .urlencode (query_params )
201201 try :
202202 result = self .make_call (query_path )
0 commit comments