Imported function

The InputGitAuthor attribute wasn't found because I forgot to import it. Still getting used to Python and importing individual modules.
This commit is contained in:
Aaron Meese
2020-08-10 08:06:14 -05:00
parent b4ab34377c
commit e2b5960e2e

View File

@@ -7,7 +7,7 @@ import base64
from pytz import timezone from pytz import timezone
import pytz import pytz
import requests import requests
from github import Github, GithubException from github import Github, GithubException, InputGitAuthor
import datetime import datetime
from string import Template from string import Template
from loc import LinesOfCode from loc import LinesOfCode
@@ -461,7 +461,7 @@ def get_stats(github):
def decode_readme(data: str): def decode_readme(data: str):
'''Decode the contets of old readme''' '''Decode the contents of old readme'''
decoded_bytes = base64.b64decode(data) decoded_bytes = base64.b64decode(data)
return str(decoded_bytes, 'utf-8') return str(decoded_bytes, 'utf-8')
@@ -487,11 +487,11 @@ if __name__ == '__main__':
waka_stats = get_stats(g) waka_stats = get_stats(g)
rdmd = decode_readme(contents.content) rdmd = decode_readme(contents.content)
new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) new_readme = generate_new_readme(stats=waka_stats, readme=rdmd)
committer = g.InputGitAuthor('readme-bot', 'readme-bot@example.com')
if new_readme != rdmd: if new_readme != rdmd:
repo.update_file(path=contents.path, message='Updated with Dev Metrics', repo.update_file(path=contents.path, message='Updated with Dev Metrics',
content=new_readme, sha=contents.sha, branch='master', content=new_readme, sha=contents.sha, branch='master',
committer=g.InputGitAuthor("readme-bot", committer=committer)
"readme-bot@example.com"))
print("Readme updated") print("Readme updated")
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()