themachine/workers/github/fetch_metadata.py
def fetch_metadata(data):
    """
    Fetches metadata from a GitHub repository

    :param data:    Dictionary with a github username as the 'username' key
    """
    log.info('Fetching metadata for GitHub user %s', data['username'])

    gh = github.Github(os.getenv('GITHUB_TOKEN'))
    gh_user = gh.get_user(data['username'])

    user = get_or_create(User, username=data['username'])
    user.username = data['username']
    user.name = gh_user.name
    user.email = gh_user.email
    user.followers = gh_user.followers
    user.save()

    repo_type = os.getenv('GITHUB_REPO_TYPES')
    log.info('Fetching repositories of type %s' % repo_type)

    for gh_repo in gh_user.get_repos(type=repo_type):
        if gh_repo.fork and os.getenv('GITHUB_NO_FORKS') == '1':
            continue

        repo = get_or_create(Repository, id=gh_repo.id)
        repo.language = gh_repo.language
        repo.git_url = gh_repo.git_url

        repo.name = gh_repo.name
        repo.full_name = gh_repo.full_name

        repo.save()
        user.update(add_to_set__repositories=repo)

        publish('github.fetch_repo', {
            'id': gh_repo.id
        })

    Fetches metadata from a GitHub repository

    :param data:    Dictionary with a github username as the 'username' key
    
Fetches metadata from a GitHub repository
Fetches metadata from a GitHub repository
def fetch_metadata(data):
    log.info('Fetching metadata for GitHub user %s', data['username'])
    gh = github.Github(os.getenv('GITHUB_TOKEN'))
    gh_user = gh.get_user(data['username'])
    user = get_or_create(User, username=data['username'])
    user.username = data['username']
    user.name = gh_user.name
    user.email = gh_user.email
    user.followers = gh_user.followers
    user.save()
    repo_type = os.getenv('GITHUB_REPO_TYPES')
    log.info('Fetching repositories of type %s' % repo_type)
    for gh_repo in gh_user.get_repos(type=repo_type):
        if gh_repo.fork and os.getenv('GITHUB_NO_FORKS') == '1':
            continue
        repo = get_or_create(Repository, id=gh_repo.id)
        repo.language = gh_repo.language
        repo.git_url = gh_repo.git_url
        repo.name = gh_repo.name
        repo.full_name = gh_repo.full_name
        repo.save()
        user.update(add_to_set__repositories=repo)
        publish('github.fetch_repo', {
            'id': gh_repo.id
        })
def fetch_metadata ( data ) : log . info ( 'Fetching metadata for GitHub user %s' , data [ 'username' ] ) gh = github . Github ( os . getenv ( 'GITHUB_TOKEN' ) ) gh_user = gh . get_user ( data [ 'username' ] ) user = get_or_create ( User , username = data [ 'username' ] ) user . username = data [ 'username' ] user . name = gh_user . name user . email = gh_user . email user . followers = gh_user . followers user . save ( ) repo_type = os . getenv ( 'GITHUB_REPO_TYPES' ) log . info ( 'Fetching repositories of type %s' % repo_type ) for gh_repo in gh_user . get_repos ( type = repo_type ) : if gh_repo . fork and os . getenv ( 'GITHUB_NO_FORKS' ) == '1' : continue repo = get_or_create ( Repository , id = gh_repo . id ) repo . language = gh_repo . language repo . git_url = gh_repo . git_url repo . name = gh_repo . name repo . full_name = gh_repo . full_name repo . save ( ) user . update ( add_to_set__repositories = repo ) publish ( 'github.fetch_repo' , { 'id' : gh_repo . id } )
Fetches metadata from a GitHub repository
Fetches metadata from a GitHub repository
"""
    Fetches metadata from a GitHub repository

    :param data:    Dictionary with a github username as the 'username' key
    """
data
Dictionary with a github username as the 'username' key
Dictionary with a github username as the ' username ' key