-
Notifications
You must be signed in to change notification settings - Fork 0
/
rallAndTrelloUserNames.py
46 lines (38 loc) · 1.35 KB
/
rallAndTrelloUserNames.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import sys
import requests
import pyral # XXX Doesn't support Python 3 & requires custom coded pyral XXX
import trello
from pyral import Rally, rallyWorkset
#Rally Setup
RALLY_URI = ""
RALLY_USER = ""
RALLY_PASS = ""
rally = Rally(RALLY_URI, RALLY_USER, RALLY_PASS)
#############
#Trello Setup
DEBUG_OUTPUT = True
TRELLO_ID = ""
TRELLO_USER = ""
TRELLO_TOKEN = ""
TRELLO_BOARD = ""
TRELLO_LIST = ""
trelloApi = trello.TrelloApi(TRELLO_ID)
trelloApi.set_token(TRELLO_TOKEN)
boards = trello.Members(TRELLO_ID, TRELLO_TOKEN).get_board(TRELLO_USER)
testBoard = [board for board in boards if board['name'] == TRELLO_BOARD][0]
boardList = [list for list in trello.Boards(TRELLO_ID, TRELLO_TOKEN).get_list(testBoard['id']) if list['name'] == TRELLO_LIST][0]
#############
#Username (trello) <-- Full Name --> E-mail (rally)
emailList = dict()
all_users = rally.getAllUsers()
for user in all_users:
rallyName = ("{} {}".format(user.FirstName, user.LastName)).lower()
emailList[rallyName] = user.EmailAddress
boardMembers = trello.Boards(TRELLO_ID, TRELLO_TOKEN).get_member(testBoard['id'])
emailToUserName = dict()
for member in boardMembers:
trelloName = ("{}".format(member['fullName'])).lower()
emailToUserName[member['username']] = emailList[trelloName]
for user in emailToUserName:
print user
################################