Created
January 23, 2018 06:48
-
-
Save Duologic/fde4008fe1986d0bb86e37912de66790 to your computer and use it in GitHub Desktop.
Get a filtered CSV of JIRA Cloud users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jira import JIRA | |
import csv | |
# Export CSV from Google Admin console | |
google_users = [] | |
with open('UserData.csv', 'r') as f: | |
reader = csv.DictReader(f) | |
for line in reader: | |
del line[''] | |
google_users.append(line) | |
# pip install jira | |
# uses ~/.netrc file for authentication | |
jira = JIRA('https://<org>.atlassian.net/') | |
jira_users = {} | |
for group in jira.groups(): | |
jira_users.update(jira.group_members(group)) | |
for user in jira_users: | |
jira_users[user]['found'] = False | |
for guser in google_users: | |
if jira_users[user]['email'] == guser['Email address']: | |
jira_users[user]['found'] = True | |
if not jira_users[user]['found']: | |
if not jira_users[user]['email'].endswith('connect.atlassian.com'): | |
print(jira_users[user]['email']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment