<commit_before>#!/usr/bin/env python
import urllib

import requests

from client import get_token

if __name__ == '__main__':
    headers = {
        'Accept': 'application/vnd.github.moondragon+json',
        'Authorization': 'token %s' % get_token()
    }
    params = {'filter': '2fa_disabled',
              'role': 'admin'}

    admins_with_1fa_url = '%s?%s' % (
        'https://api.github.com/orgs/%s/members' % 'mozilla',
        urllib.urlencode(params)
    )
    resp = requests.get(admins_with_1fa_url, headers=headers)

    bad_admins = resp.json()
    print 'The following admins DO NOT HAVE 2FA:'
    for a in bad_admins:
        print a['login']<commit_msg>Support interim API<commit_after>#!/usr/bin/env python
import urllib

import requests

from client import get_token

if __name__ == '__main__':
    headers = {
        # new api requires new accept per
        # https://developer.github.com/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/#preview-period
        'Accept': 'application/vnd.github.ironman-preview+json',
        'Authorization': 'token %s' % get_token()
    }
    params = {'filter': '2fa_disabled',
              'role': 'admin'}

    admins_with_1fa_url = '%s?%s' % (
        'https://api.github.com/orgs/%s/members' % 'mozilla',
        urllib.urlencode(params)
    )
    resp = requests.get(admins_with_1fa_url, headers=headers)

    bad_admins = resp.json()

    # for orgs that don't yet support the new API, the 'role' filter is
    # not honored. Filter those out by checking the 'site_admin' key.
    real_admins = [x for x in bad_admins if x['site_admin']]
    if len(real_admins):
        print 'The following admins DO NOT HAVE 2FA:'
        for a in real_admins:
            print a['login']
    else:
        print 'Congrats! All admins have 2FA enabled!'
{'fraction_non_alphanumeric': 0.12792596624931954, 'fraction_numerical': 0.009254218835057159, 'mean_word_length': 2.853249475890985, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6214909', 'n_tokens_mistral': 635, 'n_tokens_neox': 602, 'n_words': 147}