Don't use a session for getting membershipworks data

This commit is contained in:
Adam Goldsmith 2018-05-08 15:59:27 -04:00
parent 437503a5b1
commit 7a7f0a324b

View File

@ -31,8 +31,7 @@ def getMembershipworksData():
BASE_URL = "https://api.membershipworks.com/v1/"
# login
sess = requests.Session()
r = sess.post(BASE_URL + 'usr',
r = requests.post(BASE_URL + 'usr',
data={"_st": "all",
"eml": MEMBERSHIPWORKS_USERNAME,
"org": "10000",
@ -40,7 +39,7 @@ def getMembershipworksData():
SFtoken = r.json()['SF']
# get list of member/staff IDs
r = sess.get(BASE_URL + "ylp",
r = requests.get(BASE_URL + "ylp",
params={"SF": SFtoken,
"lbl": "5ae37979f033bfe8534f8799,5771675edcdf126302a2f6b9", # members and staff
"org": "15475", # unknown
@ -49,14 +48,14 @@ def getMembershipworksData():
# get members CSV
# TODO: maybe can just use previous get instead? would return JSON
r = sess.post(BASE_URL + "csv",
r = requests.post(BASE_URL + "csv",
params={"SF": SFtoken},
data={"_rt": "946702800", # unknown
"mux": "", # unknown
"tid": ",".join(ids), # ids of members to get
"var": "lvl,xws,xms,xsc,xrs,xfd,xac,phn,eml,lbl,nam"}) # which columns to get
return r.text
return r.text
def makeMember(member, doorAuth):
"""Create an output CSV row for the member"""