File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,17 @@ class APIOperationBase(APIOperationBaseInterface):
70
70
try :
71
71
#if #TODO
72
72
home = os .path .expanduser ("~" )
73
- propertiesfilename = os .path .join (home , "anet_python_sdk_properties.ini" )
74
- parser .read (propertiesfilename )
73
+ homedirpropertiesfilename = os .path .join (home , "anet_python_sdk_properties.ini" )
74
+
75
+ currdir = os .getcwd ()
76
+ currdirpropertiesfilename = os .path .join (currdir , "anet_python_sdk_properties.ini" )
77
+
78
+ if (os .path .exists (homedirpropertiesfilename )):
79
+ parser .read (homedirpropertiesfilename )
80
+ elif (os .path .exists (currdirpropertiesfilename )):
81
+ parser .read (currdirpropertiesfilename )
82
+ else :
83
+ print "you do not have anet_python_sdk_properties.ini file neither in home nor in current working directory"
75
84
except IOError , error :
76
85
sys .exit ( error )
77
86
else :
Original file line number Diff line number Diff line change @@ -20,8 +20,17 @@ def setUp(self):
20
20
self .amount = str (round (random .random ()* 100 , 2 ))
21
21
parser = SafeConfigParser ()
22
22
home = os .path .expanduser ("~" )
23
- propertiesfilename = os .path .join (home , "anet_python_sdk_properties.ini" )
24
- parser .read (propertiesfilename )
23
+ homedirpropertiesfilename = os .path .join (home , "anet_python_sdk_properties.ini" )
24
+
25
+ currdir = os .getcwd ()
26
+ currdirpropertiesfilename = os .path .join (currdir , "anet_python_sdk_properties.ini" )
27
+
28
+ if (os .path .exists (homedirpropertiesfilename )):
29
+ parser .read (homedirpropertiesfilename )
30
+ elif (os .path .exists (currdirpropertiesfilename )):
31
+ parser .read (currdirpropertiesfilename )
32
+ else :
33
+ print "you do not have anet_python_sdk_properties.ini file neither in home nor in current working directory"
25
34
26
35
self .api_login_id = parser .get ("properties" , "api.login.id" )
27
36
self .transaction_key = parser .get ("properties" , "transaction.key" )
You can’t perform that action at this time.
0 commit comments