def get_all_gitignore_templates():
     try:
         gh = Github(timeout=5)
         return gh.get_gitignore_templates()
     except:
         raise Exception(
             "Could not retrieve .gitignore templates from Github")
def github_select_gitignore_template(gitclass:github.Github)->str:
    alltemplates = gitclass.get_gitignore_templates()
    alltemplates.append('No Gitignore')
    q = [
        {
            'type': 'list',
            'name': 'Gitignore Template',
            'message': 'Select Gitignore Template',
            'choices': alltemplates,
        }
    ]
    answer = prompt(q)['Gitignore Template']
    if answer == 'No Gitignore':
        return
    else:
        return answer
from github import Github
from github_token import GITHUB_TOKEN, user, password

g1 = Github(GITHUB_TOKEN)
g2 = Github(user, password)

#List all templates available to pass
#as an option when creating a repository
gitignore_templates = g1.get_gitignore_templates()
print(gitignore_templates)

for gitignore_template in gitignore_templates:
    name = gitignore_template
    print(name)
    print(g1.get_gitignore_template(name))