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
@@ -286,7 +287,7 @@ def request_raw(self, method, url, params=None, apiKeyRequired=True):
286287 raise Error (
287288 'No API key provided. Set an API key via "easypost.api_key = \' APIKEY\' . '
288289 'Your API keys can be found in your EasyPost dashboard, or you can email us '
289- 'at [email protected] for assistance.' )
290+ 'at {} for assistance.' . format ( SUPPORT_EMAIL ) )
290291
291292 abs_url = self .api_url (url )
292293 params = self ._objects_to_ids (params )
@@ -324,8 +325,8 @@ def request_raw(self, method, url, params=None, apiKeyRequired=True):
324325 elif request_lib == 'requests' :
325326 http_body , http_status = self .requests_request (method , abs_url , headers , params )
326327 else :
327- raise Error ("Bug discovered: invalid request_lib: %s . "
328- "Please report to [email protected] ." % request_lib )
328+ raise Error ("Bug discovered: invalid request_lib: {} . "
329+ "Please report to {}." . format ( request_lib , SUPPORT_EMAIL ) )
329330
330331 return http_body , http_status , my_api_key
331332
@@ -347,8 +348,8 @@ def requests_request(self, method, abs_url, headers, params):
347348 elif method == 'post' or method == 'put' :
348349 data = self .encode (params )
349350 else :
350- raise Error ("Bug discovered: invalid request method: %s . "
351- "Please report to [email protected] ." % method )
351+ raise Error ("Bug discovered: invalid request method: {} . "
352+ "Please report to {}." . format ( method , SUPPORT_EMAIL ) )
352353
353354 try :
354355 result = requests_session .request (
@@ -363,7 +364,7 @@ def requests_request(self, method, abs_url, headers, params):
363364 http_status = result .status_code
364365 except Exception as e :
365366 raise Error ("Unexpected error communicating with EasyPost. If this "
366- "problem persists please let us know at [email protected] ." ,
367+ "problem persists please let us know at {}." . format ( SUPPORT_EMAIL ) ,
367368 original_exception = e )
368369 return http_body , http_status
369370
@@ -374,8 +375,8 @@ def urlfetch_request(self, method, abs_url, headers, params):
374375 elif method == 'get' or method == 'delete' :
375376 abs_url = self .build_url (abs_url , params )
376377 else :
377- raise Error ("Bug discovered: invalid request method: %s . Please report "
378- 378+ raise Error ("Bug discovered: invalid request method: {} . Please report "
379+ "to {}." . format ( method , SUPPORT_EMAIL ) )
379380
380381 args ['url' ] = abs_url
381382 args ['method' ] = method
@@ -387,7 +388,7 @@ def urlfetch_request(self, method, abs_url, headers, params):
387388 result = urlfetch .fetch (** args )
388389 except Exception as e :
389390 raise Error ("Unexpected error communicating with EasyPost. "
390- "If this problem persists, let us know at [email protected] ." ,
391+ "If this problem persists, let us know at {}." . format ( SUPPORT_EMAIL ) ,
391392 original_exception = e )
392393
393394 return result .content , result .status_code
0 commit comments