-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcredentials.py
51 lines (38 loc) · 1.55 KB
/
credentials.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
from configparser import ConfigParser, NoOptionError
try:
parser = ConfigParser()
cfg_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'stockfinder' + '.ini')
parser.read(cfg_file)
except(FileExistsError, Exception) as e:
print('Exception reading settings file: [{}]'.format(e))
def get_email():
try:
return parser.get('CREDENTIALS', 'email')
except(ValueError, NoOptionError, Exception) as e2:
print('Exception retrieving email address: [{}]'.format(e2))
def get_email_password():
try:
return parser.get('CREDENTIALS', 'password')
except(ValueError, NoOptionError, Exception) as e2:
print('Exception retrieving email password: [{}]'.format(e2))
def get_to_number():
try:
return parser.get('CREDENTIALS', 'to_number')
except(ValueError, NoOptionError, Exception) as e2:
print('Exception retrieving to-number: [{}]'.format(e2))
def get_from_number():
try:
return parser.get('CREDENTIALS', 'from_number')
except(ValueError, NoOptionError, Exception) as e2:
print('Exception retrieving from-number: [{}]'.format(e2))
def get_account_sid():
try:
return parser.get('CREDENTIALS', 'account_sid')
except(ValueError, NoOptionError, Exception) as e2:
print('Exception retrieving account sid: [{}]'.format(e2))
def get_auth_token():
try:
return parser.get('CREDENTIALS', 'auth_token')
except(ValueError, NoOptionError, Exception) as e2:
print('Exception retrieving auth token: [{}]'.format(e2))