Skip to content

Commit

Permalink
add create_directory_service in try
Browse files Browse the repository at this point in the history
  • Loading branch information
sfonteneau committed Sep 3, 2024
1 parent 5da99f6 commit d348da4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gapslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
config = configparser.ConfigParser()
config.read('/etc/gaps/gaps.conf')

logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler())

logfile = config.get('common', 'logfile')
fhandler = logging.FileHandler(logfile)
logger.addHandler(fhandler)
Expand Down Expand Up @@ -89,7 +92,11 @@ def create_directory_service(user_email):

def update_password(mail, pwd, sha1hashnt):
# Create a new service object
service = create_directory_service(config.get('google', 'admin_email'))
try:
service = create_directory_service(config.get('google', 'admin_email'))
except:
logger.error(json.dumps({'status':"error",'msg':str(e),'timestamp': str(datetime.datetime.utcnow())}))
return

try:
user = service.users().get(userKey = mail).execute()
Expand Down

0 comments on commit d348da4

Please sign in to comment.