Created
April 27, 2019 04:12
-
-
Save bnikanjam/5d6f3c4752dfa3543ebd9bd1c71e4a32 to your computer and use it in GitHub Desktop.
Post input function source code to your Github gist.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def post_gist(func_name, git_token, gist_description=None, public=True): | |
"""Post input function source code to your Github gist.""" | |
from inspect import getsource | |
from github import Github, InputFileContent | |
if not gist_description: | |
gist_description = func_name.__doc__ | |
me = Github(git_token).get_user() | |
code = {func_name.__name__ + '.py': InputFileContent(getsource(func_name))} | |
me.create_gist(public, code, gist_description) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment