Package workspace ::
Package python-fedex ::
Package fedex ::
Module 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 import sys
13
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 - def __init__(self, key, password, account_number=None, meter_number=None,
23 integrator_id=None, wsdl_path=None, use_test_server=False):
24 """
25 @type key: L{str}
26 @param key: Developer test key.
27 @type password: L{str}
28 @param password: The Fedex-generated password for your Web Systems
29 account. This is generally emailed to you after registration.
30 @type account_number: L{str}
31 @keyword account_number: The account number sent to you by Fedex after
32 registering for Web Services.
33 @type meter_number: L{str}
34 @keyword meter_number: The meter number sent to you by Fedex after
35 registering for Web Services.
36 @type integrator_id: L{str}
37 @keyword integrator_id: The integrator string sent to you by Fedex after
38 registering for Web Services.
39 @type wsdl_path: L{str}
40 @keyword wsdl_path: In the event that you want to override the path to
41 your WSDL directory, do so with this argument.
42 @type use_test_server: L{bool}
43 @keyword use_test_server: When this is True, test server WSDLs are used
44 instead of the production server. You will also need to make sure
45 that your L{FedexConfig} object has a production account number,
46 meter number, authentication key, and password.
47 """
48 self.key = key
49 """@ivar: Developer test key."""
50 self.password = password
51 """@ivar: Fedex Web Services password."""
52 self.account_number = account_number
53 """@ivar: Web Services account number."""
54 self.meter_number = meter_number
55 """@ivar: Web services meter number."""
56 self.integrator_id = integrator_id
57 """@ivar: Web services integrator ID."""
58 self.use_test_server = use_test_server
59 """@ivar: When True, point to the test server."""
60
61
62 if wsdl_path == None:
63 self.wsdl_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
64 'wsdl')
65 else:
66 self.wsdl_path = wsdl_path
67