Exemplo n.º 1
0
def parse_request(payload):
    """Parses POST requst from Github and
    returns list of Commit objects.
    """
    payload = json.loads(payload, encoding='utf-8')
    commits = []
    for commitInfo in payload['commits']:
        author = Author(name=str(commitInfo['author']['name']),
                        email=str(commitInfo['author']['email']))
        commit = Commit(commitId=str(commitInfo['id']),
                        author=author,
                        message=str(commitInfo['message']),
                        date=str(commitInfo['timestamp']),
                        url=str(commitInfo['url']))
        commits.append(commit)
    return commits