#!/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']

@@ -120,16 +120,191 @@
 ers = %7B%0A
+        # new api requires new accept per%0A        # https://developer.github.com/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/#preview-period%0A
         
@@ -341,18 +341,23 @@
 hub.
-moondragon
+ironman-preview
 +jso
@@ -715,24 +715,257 @@
 resp.json()%0A
+%0A    # for orgs that don't yet support the new API, the 'role' filter is%0A    # not honored. Filter those out by checking the 'site_admin' key.%0A    real_admins = %5Bx for x in bad_admins if x%5B'site_admin'%5D%5D%0A    if len(real_admins):%0A    
     print 'T
@@ -1006,16 +1006,20 @@
 A:'%0A    
+ 
+   
 for a in
@@ -1015,27 +1015,28 @@
    for a in 
-bad
+real
 _admins:%0A   
@@ -1036,24 +1036,28 @@
 ns:%0A        
+  
+  
 print a%5B'log
@@ -1061,8 +1061,73 @@
 login'%5D%0A
+    else:%0A        print 'Congrats! All admins have 2FA enabled!'%0A

Support interim API