def get_pw(username): """ Required get_password function used for flask-httpauth. """ if username in users: return users.get(username) return None
def get_user_activity(repositories): user_activity = {} for repo in repositories: commit_list = get_commits(repo["name"]) for commit in commit_list: email = commit['commit']['committer']['email'] if email not in USERS.keys(): continue commit_date_time = parse(commit['commit']['committer']['date']) name = USERS[email]['full_name'] if name not in user_activity.keys(): user_activity[name] = "" commit_url = repo["html_url"] + '/commit/' + commit["sha"] github_body = "<hr/> <b>{0}</b> @ <font color=".format( commit_date_time.strftime("%H:%M"), name) github_body += 'red' github_body += ">{0}</font><a href='{2}'>\ {1}</a>".format(repo["name"], "comitted", commit_url) github_body += "<br />" github_body += "<font color='violet'>" github_body += commit["commit"]["message"] + "</font><br/>" if github_body: user_activity[name] += github_body github_body = "" return user_activity
def load_user(id): return USERS.get(int(id))
def get_password(username): return users.get(username, None)