def get_repo_data(org_name): repos = github3.repositories_by(org_name) repos_dict = {} for r in repos: repos_dict[r.name] = { 'name': r.name, 'description': r.description, 'html_url': r.html_url, 'stargazers_count': r.stargazers_count, 'forks_count': r.forks_count } return repos_dict
def test_repositories_by(self): """Show that github3.repositories_by proxies to GitHub.""" args = ('login', None, None, None, -1, None) github3.repositories_by('login') self.gh.repositories_by.assert_called_with(*args)
#!/usr/bin/env python3 import os import github3 import re import shutil root_url = 'https://github.com/' for repo in github3.repositories_by('momozor'): os.system('git clone {}{}'.format(root_url, repo)) # Pull new commits path = re.sub('momozor\/', '', str(repo)) os.chdir(path) os.system('git pull') os.chdir('..') backup_archive_path = '{}/Documents/general/ghb-backup-ar'.format( os.environ['HOME']) shutil.rmtree(backup_archive_path) os.makedirs(backup_archive_path) os.system( 'tar -cvzf /tmp/momozor-github-backup.tar.gz .; mv /tmp/momozor-github-backup.tar.gz {}' .format(backup_archive_path))
#!/usr/bin/env python3 import os import github3 import re import shutil root_url = 'https://github.com/' for repo in github3.repositories_by('faraco'): os.system('git clone {}{}'.format(root_url, repo)) # Pull new commits path = re.sub('faraco\/', '', str(repo)) os.chdir(path) os.system('git pull') os.chdir('..') backup_archive_path = '{}/Documents/general/ghb-backup-ar'.format(os.environ['HOME']) shutil.rmtree(backup_archive_path) os.makedirs(backup_archive_path) os.system('tar -cvzf /tmp/faraco-github-backup.tar.gz .; mv /tmp/faraco-github-backup.tar.gz {}'.format(backup_archive_path))