1414__author__ = 'EasyPost <[email protected] >' 1515__version__ = VERSION
1616version_info = VERSION_INFO
17+ SUPPORT_EMAIL = '[email protected] ' 1718
1819
1920# use urlfetch as request_lib on google app engine, otherwise use requests
3536 except ImportError :
3637 raise ImportError ('EasyPost requires an up to date requests library. '
3738 'Update requests via "pip install -U requests" or '
38- 'contact us at [email protected] .' )
39+ 'contact us at {}.' . format ( SUPPORT_EMAIL ) )
3940
4041 try :
4142 version = requests .__version__
4243 major , minor , patch = [int (i ) for i in version .split ('.' )]
4344 except Exception :
4445 raise ImportError ('EasyPost requires an up to date requests library. '
4546 'Update requests via "pip install -U requests" or contact '
46- 47+ 'us at {}.' . format ( SUPPORT_EMAIL ) )
4748 else :
4849 if major < 1 :
4950 raise ImportError ('EasyPost requires an up to date requests library. Update '
5051 'requests via "pip install -U requests" or contact us '
51- 52+ 'at {}.' . format ( SUPPORT_EMAIL ) )
5253
5354# config
5455api_key = None
@@ -276,7 +277,7 @@ def request_raw(self, method, url, params=None, apiKeyRequired=True):
276277 raise Error (
277278 'No API key provided. Set an API key via "easypost.api_key = \' APIKEY\' . '
278279 'Your API keys can be found in your EasyPost dashboard, or you can email us '
279- 'at [email protected] for assistance.' )
280+ 'at {} for assistance.' . format ( SUPPORT_EMAIL ) )
280281
281282 abs_url = self .api_url (url )
282283 params = self ._objects_to_ids (params )
@@ -314,8 +315,8 @@ def request_raw(self, method, url, params=None, apiKeyRequired=True):
314315 elif request_lib == 'requests' :
315316 http_body , http_status = self .requests_request (method , abs_url , headers , params )
316317 else :
317- raise Error ("Bug discovered: invalid request_lib: %s . "
318- "Please report to [email protected] ." % request_lib )
318+ raise Error ("Bug discovered: invalid request_lib: {} . "
319+ "Please report to {}." . format ( request_lib , SUPPORT_EMAIL ) )
319320
320321 return http_body , http_status , my_api_key
321322
@@ -337,8 +338,8 @@ def requests_request(self, method, abs_url, headers, params):
337338 elif method == 'post' or method == 'put' :
338339 data = self .encode (params )
339340 else :
340- raise Error ("Bug discovered: invalid request method: %s . "
341- "Please report to [email protected] ." % method )
341+ raise Error ("Bug discovered: invalid request method: {} . "
342+ "Please report to {}." . format ( method , SUPPORT_EMAIL ) )
342343
343344 try :
344345 result = requests_session .request (
@@ -353,7 +354,7 @@ def requests_request(self, method, abs_url, headers, params):
353354 http_status = result .status_code
354355 except Exception as e :
355356 raise Error ("Unexpected error communicating with EasyPost. If this "
356- "problem persists please let us know at [email protected] ." ,
357+ "problem persists please let us know at {}." . format ( SUPPORT_EMAIL ) ,
357358 original_exception = e )
358359 return http_body , http_status
359360
@@ -364,8 +365,8 @@ def urlfetch_request(self, method, abs_url, headers, params):
364365 elif method == 'get' or method == 'delete' :
365366 abs_url = self .build_url (abs_url , params )
366367 else :
367- raise Error ("Bug discovered: invalid request method: %s . Please report "
368- 368+ raise Error ("Bug discovered: invalid request method: {} . Please report "
369+ "to {}." . format ( method , SUPPORT_EMAIL ) )
369370
370371 args ['url' ] = abs_url
371372 args ['method' ] = method
@@ -377,7 +378,7 @@ def urlfetch_request(self, method, abs_url, headers, params):
377378 result = urlfetch .fetch (** args )
378379 except Exception as e :
379380 raise Error ("Unexpected error communicating with EasyPost. "
380- "If this problem persists, let us know at [email protected] ." ,
381+ "If this problem persists, let us know at {}." . format ( SUPPORT_EMAIL ) ,
381382 original_exception = e )
382383
383384 return result .content , result .status_code
0 commit comments