def commit_image_to_github(path, message, file_, name, email, sha=None,
branch=u'master'):
"""
Save given image file content to github
:param path: Path to file (<owner>/<repo>/<dir>/.../<filename>)
:param message: Commit message to save file with
:param file_: Open file object
:param name: Name of author who wrote file
:param email: Email address of author
:param sha: Optional SHA of file if it already exists on github
:param branch: Name of branch to commit file to (branch must already
exist)
:returns: SHA of commit or None for failure
"""
contents = base64.encodestring(file_.read())
return commit_file_to_github(path, message, contents, name, email, sha=sha,
branch=branch, auto_encode=False)
评论列表
文章目录