[bonfiredemokit] Annotation of /ea/credentials.py
Annotation of /ea/credentials.py
Parent Directory
| Revision Log
Revision 1 -
(view)
(download)
(as text)
1 : |
agomez |
1 |
import os
|
2 : |
|
|
|
3 : |
|
|
def getpass(file):
|
4 : |
|
|
filepath=os.path.expanduser(file)
|
5 : |
|
|
password=None
|
6 : |
|
|
try:
|
7 : |
|
|
f=open(filepath,'r')
|
8 : |
|
|
for line in f.readlines():
|
9 : |
|
|
if line.find('password') == 0 :
|
10 : |
|
|
password=line.split()[1]
|
11 : |
|
|
except IOError:
|
12 : |
|
|
print 'ERROR: You must include your credentials in ' + file
|
13 : |
|
|
exit()
|
14 : |
|
|
if password == None:
|
15 : |
|
|
print 'ERROR: You must include your password in ' + file
|
16 : |
|
|
exit()
|
17 : |
|
|
|
18 : |
|
|
return password
|
19 : |
|
|
|
20 : |
|
|
def getuser(file):
|
21 : |
|
|
user=None
|
22 : |
|
|
filepath=os.path.expanduser(file)
|
23 : |
|
|
try:
|
24 : |
|
|
f=open(filepath,'r')
|
25 : |
|
|
for line in f.readlines():
|
26 : |
|
|
if line.find('user') == 0 :
|
27 : |
|
|
user=line.split()[1]
|
28 : |
|
|
except IOError:
|
29 : |
|
|
print 'ERROR: You must include your credentials in ' + file
|
30 : |
|
|
exit()
|
31 : |
|
|
if user == None:
|
32 : |
|
|
print 'ERROR: You must include your username in ' + file
|
33 : |
|
|
exit()
|
34 : |
|
|
|
35 : |
|
|
return user
|
|