def get_repos(org, repo_type, access_token=None, username=None, password=None, per_page=25):
    """
    Paginates through all of the repositories using github's Link header.
        https://developer.github.com/v3/#link-header
    """
    url = API_BASE + 'orgs/%s/repos?' % org
    qs_params = {'type': repo_type, 'per_page': per_page}
    if access_token:
        qs_params.update({'access_token': args.access_token})
        url += urlencode(qs_params)
        request = urllib2.Request(url)
    elif username and password:
        url += urlencode(qs_params)
        request = urllib2.Request(url)
        add_https_basic_auth(request, username, password)
    else:
        raise ValueError('unworkable combination of authentication inputs')

    response = urllib2.urlopen(request)
    try:
        pagination = get_pagination(response.headers['Link'])
    except KeyError:
        print 'no Link header, nothing to paginate through.'
        pagination = Pagination(None, None, None, None)

    repos = json.loads(response.read())
    for r in repos:
        if not r.get('archived'):
            yield r

    # so, this isn't the DRYest code ;-)
    while pagination.next:
        request = urllib2.Request(pagination.next)
        if username and password:
            add_https_basic_auth(request, username, password)
        response = urllib2.urlopen(request)
        pagination = get_pagination(response.headers['Link'])
        repos = json.loads(response.read())
        for r in repos:
            if not r.get('archived'):
                yield r