MrBr
MrBr

Reputation: 541

Creating Gist with PyGithub

Is there an option to create new Gist with PyGithub?

There is such API option on GitHub, however it seems to be missing in PyGithub.

Upvotes: 1

Views: 442

Answers (1)

MrBr
MrBr

Reputation: 541

Use Github.get_user followed by AuthenticatedUser.create_gist:

gh = github.Github("auth token")
gh_auth_user = gh.get_user()
gist = gh_auth_user.create_gist(public=False, files={"myfile.txt": github.InputFileContent("my contents")}, description="my description")

Upvotes: 1

Related Questions