Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # *Information
- # File - GithubRepoDownload.py
- # Project - GithubRepoDownload
- # Description - the primary file for GithubRepoDownload
- # Requirements: PyGithub
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # *Imports
- import getpass
- import os
- import urllib.request
- from github import Github
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # *Primary Function
- def main():
- print(os.getcwd())
- username = input("Github Username ~ ")
- password = getpass.getpass("Github Password ~ ")
- ghub = Github(username, password)
- for repo in ghub.get_user().get_repos():
- if not os.path.exists(os.getcwd() + "\\" + repo.name):
- os.makedirs(os.getcwd() + "\\" + repo.name)
- for branch in repo.get_branches():
- download_url = repo.html_url + "/archive/" + branch.name + ".zip"
- urllib.request.urlretrieve(download_url, repo.name + "\\" + branch.name + ".zip")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement