def update_gist(title: str, content: str) -> bool: access_token = os.environ[ENV_VAR_GITHUB_TOKEN] gist_id = os.environ[ENV_VAR_GIST_ID] gist = Github(access_token).get_gist(gist_id) # Shouldn't necessarily work, keeping for case of single file made in hurry to get gist id. old_title = list(gist.files.keys())[0] gist.edit(title, {old_title: InputFileContent(content, title)}) print(f"{title}\n{content}")
def update_gist(title: str, content: str) -> bool: """Update gist with provided title and content. Use gist id and github token present in environment variables. Replace first file in the gist. """ access_token = os.environ[ENV_VAR_GITHUB_TOKEN] gist_id = os.environ[ENV_VAR_GIST_ID] gist = Github(access_token).get_gist(gist_id) # Works only for single file. Should we clear all files and create new file? old_title = list(gist.files.keys())[0] gist.edit(title, {old_title: InputFileContent(content, title)}) print(f"{title}\n{content}")