30
30
import six .moves .urllib .parse as urlparse
31
31
32
32
from .auth import JWT , Auth , AccessRequest
33
- from .error import BatchError , UnavailableError , ClientError , RequestError , ServerError
33
+ from .error import BatchError , UnavailableError , ClientError , RequestError , ServerError , ArgumentError
34
34
from .version import __version__ as umapi_version
35
35
36
36
@@ -119,7 +119,7 @@ def __init__(self,
119
119
elif auth_dict :
120
120
self .auth = self ._get_auth (ims_host = ims_host , ims_endpoint_jwt = ims_endpoint_jwt , ** auth_dict )
121
121
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" )
123
123
self .session = requests .Session ()
124
124
ua_string = "umapi-client/" + umapi_version + " Python/" + python_version () + " (" + platform_version () + ")"
125
125
if user_agent and user_agent .strip ():
@@ -133,7 +133,7 @@ def _get_auth(self, ims_host, ims_endpoint_jwt,
133
133
tech_acct_id = tech_acct_id or kwargs .get ("tech_acct" )
134
134
private_key_file = private_key_file or kwargs .get ("priv_key_path" )
135
135
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" )
137
137
if private_key_data :
138
138
jwt = JWT (self .org_id , tech_acct_id , ims_host , api_key , six .StringIO (private_key_data ))
139
139
else :
@@ -196,7 +196,7 @@ def query_single(self, object_type, url_params, query_params=None):
196
196
query_type = object_type + "s" # poor man's plural
197
197
query_path = "/organizations/{}/{}" .format (self .org_id , query_type )
198
198
for component in url_params if url_params else []:
199
- query_path += "/" + urlparse .quote (component )
199
+ query_path += "/" + urlparse .quote (component , safe = '/@' )
200
200
if query_params : query_path += "?" + urlparse .urlencode (query_params )
201
201
try :
202
202
result = self .make_call (query_path )
0 commit comments