{"action":"created","comment":{"url":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/comments/37234930","id":37234930,"diff_hunk":"@@ -1,25 +1,61 @@\n #!/usr/bin/env python\n import urllib\n+import argparse\n+import logging\n \n import requests\n \n from client import get_token\n \n-if __name__ == '__main__':\n+logger = logging.getLogger(__name__)\n+\n+def check_admins(org):\n     headers = {\n-        'Accept': 'application/vnd.github.moondragon+json',\n+        # new api requires new accept per\n+        # https://developer.github.com/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/#preview-period\n+        'Accept': 'application/vnd.github.ironman-preview+json',\n         'Authorization': 'token %s' % get_token()\n     }\n     params = {'filter': '2fa_disabled',\n               'role': 'admin'}\n \n     admins_with_1fa_url = '%s?%s' % (\n-        'https://api.github.com/orgs/%s/members' % 'mozilla',\n+        'https://api.github.com/orgs/%s/members' % org,\n         urllib.urlencode(params)\n     )\n     resp = requests.get(admins_with_1fa_url, headers=headers)\n+    if resp.status_code not in [200,]:\n+        logging.warn(\"Failed request for %s (code %d)\", org,\n+                resp.status_code)","path":"admins.py","position":32,"original_position":32,"commit_id":"245e0f70322772e095bd189cad382c4cca13d5e6","original_commit_id":"245e0f70322772e095bd189cad382c4cca13d5e6","user":{"login":"fwenzel","id":87232,"avatar_url":"https://avatars.githubusercontent.com/u/87232?v=3","gravatar_id":"","url":"https://api.github.com/users/fwenzel","html_url":"https://github.com/fwenzel","followers_url":"https://api.github.com/users/fwenzel/followers","following_url":"https://api.github.com/users/fwenzel/following{/other_user}","gists_url":"https://api.github.com/users/fwenzel/gists{/gist_id}","starred_url":"https://api.github.com/users/fwenzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwenzel/subscriptions","organizations_url":"https://api.github.com/users/fwenzel/orgs","repos_url":"https://api.github.com/users/fwenzel/repos","events_url":"https://api.github.com/users/fwenzel/events{/privacy}","received_events_url":"https://api.github.com/users/fwenzel/received_events","type":"User","site_admin":false},"body":"indent","created_at":"2015-08-17T20:48:14Z","updated_at":"2015-08-17T20:48:14Z","html_url":"https://github.com/fwenzel/github-org-scripts/pull/7#discussion_r37234930","pull_request_url":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/comments/37234930"},"html":{"href":"https://github.com/fwenzel/github-org-scripts/pull/7#discussion_r37234930"},"pull_request":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7","id":42372848,"html_url":"https://github.com/fwenzel/github-org-scripts/pull/7","diff_url":"https://github.com/fwenzel/github-org-scripts/pull/7.diff","patch_url":"https://github.com/fwenzel/github-org-scripts/pull/7.patch","issue_url":"https://api.github.com/repos/fwenzel/github-org-scripts/issues/7","number":7,"state":"open","locked":false,"title":"Add cli parsing","user":{"login":"hwine","id":132412,"avatar_url":"https://avatars.githubusercontent.com/u/132412?v=3","gravatar_id":"","url":"https://api.github.com/users/hwine","html_url":"https://github.com/hwine","followers_url":"https://api.github.com/users/hwine/followers","following_url":"https://api.github.com/users/hwine/following{/other_user}","gists_url":"https://api.github.com/users/hwine/gists{/gist_id}","starred_url":"https://api.github.com/users/hwine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwine/subscriptions","organizations_url":"https://api.github.com/users/hwine/orgs","repos_url":"https://api.github.com/users/hwine/repos","events_url":"https://api.github.com/users/hwine/events{/privacy}","received_events_url":"https://api.github.com/users/hwine/received_events","type":"User","site_admin":false},"body":"I added my \"standard\" python script wrapper. Once we've agreed on the format, I'll do the same for some of the other scripts.\r\nI have 3 orgs I admin, not having to edit the script is a huge win for me. :smile:","created_at":"2015-08-13T16:50:04Z","updated_at":"2015-08-17T20:48:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3aa0785f53a0ed77a5094056f510c8b4f8078b43","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7/commits","review_comments_url":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7/comments","review_comment_url":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fwenzel/github-org-scripts/issues/7/comments","statuses_url":"https://api.github.com/repos/fwenzel/github-org-scripts/statuses/245e0f70322772e095bd189cad382c4cca13d5e6","head":{"label":"hwine:add-cli-parsing","ref":"add-cli-parsing","sha":"245e0f70322772e095bd189cad382c4cca13d5e6","user":{"login":"hwine","id":132412,"avatar_url":"https://avatars.githubusercontent.com/u/132412?v=3","gravatar_id":"","url":"https://api.github.com/users/hwine","html_url":"https://github.com/hwine","followers_url":"https://api.github.com/users/hwine/followers","following_url":"https://api.github.com/users/hwine/following{/other_user}","gists_url":"https://api.github.com/users/hwine/gists{/gist_id}","starred_url":"https://api.github.com/users/hwine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwine/subscriptions","organizations_url":"https://api.github.com/users/hwine/orgs","repos_url":"https://api.github.com/users/hwine/repos","events_url":"https://api.github.com/users/hwine/events{/privacy}","received_events_url":"https://api.github.com/users/hwine/received_events","type":"User","site_admin":false},"repo":{"id":40375343,"name":"github-org-scripts","full_name":"hwine/github-org-scripts","owner":{"login":"hwine","id":132412,"avatar_url":"https://avatars.githubusercontent.com/u/132412?v=3","gravatar_id":"","url":"https://api.github.com/users/hwine","html_url":"https://github.com/hwine","followers_url":"https://api.github.com/users/hwine/followers","following_url":"https://api.github.com/users/hwine/following{/other_user}","gists_url":"https://api.github.com/users/hwine/gists{/gist_id}","starred_url":"https://api.github.com/users/hwine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwine/subscriptions","organizations_url":"https://api.github.com/users/hwine/orgs","repos_url":"https://api.github.com/users/hwine/repos","events_url":"https://api.github.com/users/hwine/events{/privacy}","received_events_url":"https://api.github.com/users/hwine/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hwine/github-org-scripts","description":"Some helper scripts to manage github orgs via API.","fork":true,"url":"https://api.github.com/repos/hwine/github-org-scripts","forks_url":"https://api.github.com/repos/hwine/github-org-scripts/forks","keys_url":"https://api.github.com/repos/hwine/github-org-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hwine/github-org-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hwine/github-org-scripts/teams","hooks_url":"https://api.github.com/repos/hwine/github-org-scripts/hooks","issue_events_url":"https://api.github.com/repos/hwine/github-org-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/hwine/github-org-scripts/events","assignees_url":"https://api.github.com/repos/hwine/github-org-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/hwine/github-org-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/hwine/github-org-scripts/tags","blobs_url":"https://api.github.com/repos/hwine/github-org-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hwine/github-org-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hwine/github-org-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/hwine/github-org-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hwine/github-org-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/hwine/github-org-scripts/languages","stargazers_url":"https://api.github.com/repos/hwine/github-org-scripts/stargazers","contributors_url":"https://api.github.com/repos/hwine/github-org-scripts/contributors","subscribers_url":"https://api.github.com/repos/hwine/github-org-scripts/subscribers","subscription_url":"https://api.github.com/repos/hwine/github-org-scripts/subscription","commits_url":"https://api.github.com/repos/hwine/github-org-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/hwine/github-org-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/hwine/github-org-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/hwine/github-org-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/hwine/github-org-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/hwine/github-org-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hwine/github-org-scripts/merges","archive_url":"https://api.github.com/repos/hwine/github-org-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hwine/github-org-scripts/downloads","issues_url":"https://api.github.com/repos/hwine/github-org-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/hwine/github-org-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/hwine/github-org-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/hwine/github-org-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hwine/github-org-scripts/labels{/name}","releases_url":"https://api.github.com/repos/hwine/github-org-scripts/releases{/id}","created_at":"2015-08-07T18:37:37Z","updated_at":"2015-08-07T18:37:37Z","pushed_at":"2015-08-14T05:40:27Z","git_url":"git://github.com/hwine/github-org-scripts.git","ssh_url":"git@github.com:hwine/github-org-scripts.git","clone_url":"https://github.com/hwine/github-org-scripts.git","svn_url":"https://github.com/hwine/github-org-scripts","homepage":null,"size":111,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fwenzel:master","ref":"master","sha":"ec9dea220160b4dd58c45a30e6809d800c32aa40","user":{"login":"fwenzel","id":87232,"avatar_url":"https://avatars.githubusercontent.com/u/87232?v=3","gravatar_id":"","url":"https://api.github.com/users/fwenzel","html_url":"https://github.com/fwenzel","followers_url":"https://api.github.com/users/fwenzel/followers","following_url":"https://api.github.com/users/fwenzel/following{/other_user}","gists_url":"https://api.github.com/users/fwenzel/gists{/gist_id}","starred_url":"https://api.github.com/users/fwenzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwenzel/subscriptions","organizations_url":"https://api.github.com/users/fwenzel/orgs","repos_url":"https://api.github.com/users/fwenzel/repos","events_url":"https://api.github.com/users/fwenzel/events{/privacy}","received_events_url":"https://api.github.com/users/fwenzel/received_events","type":"User","site_admin":false},"repo":{"id":28990032,"name":"github-org-scripts","full_name":"fwenzel/github-org-scripts","owner":{"login":"fwenzel","id":87232,"avatar_url":"https://avatars.githubusercontent.com/u/87232?v=3","gravatar_id":"","url":"https://api.github.com/users/fwenzel","html_url":"https://github.com/fwenzel","followers_url":"https://api.github.com/users/fwenzel/followers","following_url":"https://api.github.com/users/fwenzel/following{/other_user}","gists_url":"https://api.github.com/users/fwenzel/gists{/gist_id}","starred_url":"https://api.github.com/users/fwenzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwenzel/subscriptions","organizations_url":"https://api.github.com/users/fwenzel/orgs","repos_url":"https://api.github.com/users/fwenzel/repos","events_url":"https://api.github.com/users/fwenzel/events{/privacy}","received_events_url":"https://api.github.com/users/fwenzel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fwenzel/github-org-scripts","description":"Some helper scripts to manage github orgs via API.","fork":false,"url":"https://api.github.com/repos/fwenzel/github-org-scripts","forks_url":"https://api.github.com/repos/fwenzel/github-org-scripts/forks","keys_url":"https://api.github.com/repos/fwenzel/github-org-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fwenzel/github-org-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fwenzel/github-org-scripts/teams","hooks_url":"https://api.github.com/repos/fwenzel/github-org-scripts/hooks","issue_events_url":"https://api.github.com/repos/fwenzel/github-org-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/fwenzel/github-org-scripts/events","assignees_url":"https://api.github.com/repos/fwenzel/github-org-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/fwenzel/github-org-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/fwenzel/github-org-scripts/tags","blobs_url":"https://api.github.com/repos/fwenzel/github-org-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fwenzel/github-org-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fwenzel/github-org-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/fwenzel/github-org-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fwenzel/github-org-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/fwenzel/github-org-scripts/languages","stargazers_url":"https://api.github.com/repos/fwenzel/github-org-scripts/stargazers","contributors_url":"https://api.github.com/repos/fwenzel/github-org-scripts/contributors","subscribers_url":"https://api.github.com/repos/fwenzel/github-org-scripts/subscribers","subscription_url":"https://api.github.com/repos/fwenzel/github-org-scripts/subscription","commits_url":"https://api.github.com/repos/fwenzel/github-org-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/fwenzel/github-org-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/fwenzel/github-org-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/fwenzel/github-org-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/fwenzel/github-org-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/fwenzel/github-org-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fwenzel/github-org-scripts/merges","archive_url":"https://api.github.com/repos/fwenzel/github-org-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fwenzel/github-org-scripts/downloads","issues_url":"https://api.github.com/repos/fwenzel/github-org-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/fwenzel/github-org-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/fwenzel/github-org-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fwenzel/github-org-scripts/labels{/name}","releases_url":"https://api.github.com/repos/fwenzel/github-org-scripts/releases{/id}","created_at":"2015-01-08T22:48:04Z","updated_at":"2015-04-08T18:38:07Z","pushed_at":"2015-08-17T20:02:55Z","git_url":"git://github.com/fwenzel/github-org-scripts.git","ssh_url":"git@github.com:fwenzel/github-org-scripts.git","clone_url":"https://github.com/fwenzel/github-org-scripts.git","svn_url":"https://github.com/fwenzel/github-org-scripts","homepage":null,"size":262,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7"},"html":{"href":"https://github.com/fwenzel/github-org-scripts/pull/7"},"issue":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/issues/7"},"comments":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/fwenzel/github-org-scripts/statuses/245e0f70322772e095bd189cad382c4cca13d5e6"}}}}