Package fedex :: Module config
[hide private]
[frames] | no frames]

Source Code for Module fedex.config

 1  """ 
 2  The L{config} module contains the L{FedexConfig} class, which is passed to 
 3  the Fedex API calls. It stores useful information such as your Web Services 
 4  account numbers and keys. 
 5   
 6  It is strongly suggested that you create a single L{FedexConfig} object in 
 7  your project and pass that to the various API calls, rather than create new 
 8  L{FedexConfig} objects haphazardly. This is merely a design suggestion, 
 9  treat it as such. 
10  """ 
11  import os 
12   
13   
14 -class FedexConfig(object):
15 """ 16 Base configuration class that is used for the different Fedex SOAP calls. 17 These are generally passed to the Fedex request classes as arguments. 18 You may instantiate a L{FedexConfig} object with the minimal C{key} and 19 C{password} arguments and set the instance variables documented below 20 at a later time if you must. 21 """ 22
23 - def __init__(self, key, password, account_number=None, meter_number=None, freight_account_number=None, 24 integrator_id=None, wsdl_path=None, express_region_code=None, use_test_server=False):
25 """ 26 @type key: L{str} 27 @param key: Developer test key. 28 @type password: L{str} 29 @param password: The Fedex-generated password for your Web Systems 30 account. This is generally emailed to you after registration. 31 @type account_number: L{str} 32 @keyword account_number: The account number sent to you by Fedex after 33 registering for Web Services. 34 @type meter_number: L{str} 35 @keyword meter_number: The meter number sent to you by Fedex after 36 registering for Web Services. 37 @type freight_account_number: L{str} 38 @keyword freight_account_number: The freight account number sent to you 39 by Fedex after registering for Web Services. 40 @type integrator_id: L{str} 41 @keyword integrator_id: The integrator string sent to you by Fedex after 42 registering for Web Services. 43 @type wsdl_path: L{str} 44 @keyword wsdl_path: In the event that you want to override the path to 45 your WSDL directory, do so with this argument. 46 @type use_test_server: L{bool} 47 @keyword use_test_server: When this is True, test server WSDLs are used 48 instead of the production server. You will also need to make sure 49 that your L{FedexConfig} object has a production account number, 50 meter number, authentication key, and password. 51 """ 52 self.key = key 53 """@ivar: Developer test key.""" 54 self.password = password 55 """@ivar: Fedex Web Services password.""" 56 self.account_number = account_number 57 """@ivar: Web Services account number.""" 58 self.meter_number = meter_number 59 """@ivar: Web services meter number.""" 60 self.freight_account_number = freight_account_number 61 """@ivar: Web Services freight accountnumber.""" 62 self.integrator_id = integrator_id 63 """@ivar: Web services integrator ID.""" 64 self.express_region_code = express_region_code 65 """@ivar: Web services ExpressRegionCode""" 66 self.use_test_server = use_test_server 67 """@ivar: When True, point to the test server.""" 68 69 # Allow overriding of the WDSL path. 70 if wsdl_path is None: 71 self.wsdl_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 72 'wsdl') 73 else: # pragma: no cover 74 self.wsdl_path = wsdl_path
75