MembershipWorks: Get org number from login data

This commit is contained in:
Adam Goldsmith 2018-09-18 14:02:58 -04:00
parent a1d2bbd842
commit 1f5acb1a91

View File

@ -40,13 +40,13 @@ def getMembershipworksData(folders, columns):
print("MembershipWorks Login Error: ", r.status_code, r.reason)
print(r.text)
sys.exit(1)
SFtoken = r.json()['SF']
login_data = r.json()
# get list of member/staff IDs
r = requests.get(BASE_URL + "ylp",
params={"SF": SFtoken,
params={"SF": login_data['SF'],
"lbl": ",".join([folder_map[f] for f in folders]),
"org": "15475", # unknown
"org": login_data['org'],
"var": "_id,nam,ctc"})
if r.status_code != 200 or 'usr' not in r.json():
print("MembershipWorks User Listing Error: ", r.status_code, r.reason)
@ -57,7 +57,7 @@ def getMembershipworksData(folders, columns):
# get members CSV
# TODO: maybe can just use previous get instead? would return JSON
r = requests.post(BASE_URL + "csv",
params={"SF": SFtoken},
params={"SF": login_data['SF']},
data={"_rt": "946702800", # unknown
"mux": "", # unknown
"tid": ",".join(ids), # ids of members to get