-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhelper_functions.py
42 lines (36 loc) · 1.28 KB
/
helper_functions.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
import os, sys, json, re
def get_name_from_email(email):
return re.split('@', email)[0]
#print get_name_from_email('[email protected]')
def get_org_name(json_data):
'''Gets the json_data, finds to_email, and returns the to name'''
sent_to_email = json_data['To']
org = re.split('@', sent_to_email)
return org[0]
def check_if_org(org_name):
#make a database connection and check if the org_name exists
return True
def get_executive_list(org_name):
'''Go to database and fetch executive list for org_name
args:
org_name (String) : name of organization.
returns:
list of executives.
'''
#Since Database doesn't exist right now, I am just returning a
#generic list of email addresses.
list_of_emails = ['[email protected]', '[email protected]']
return list_of_emails
#Test get_executive_list
#print(get_executive_list('asme'))
def get_member_list(org_name):
'''Go to database and fetch member list for org_name
args:
org_name (String) : name of organization.
returns:
list of executives.
'''
#Since Database doesn't exist right now, I am just returning a
#generic list of email addresses.
list_of_emails = ['[email protected]', '[email protected]']
return list_of_emails