Don't use a session for getting membershipworks data
This commit is contained in:
parent
437503a5b1
commit
7a7f0a324b
@ -31,32 +31,31 @@ def getMembershipworksData():
|
|||||||
BASE_URL = "https://api.membershipworks.com/v1/"
|
BASE_URL = "https://api.membershipworks.com/v1/"
|
||||||
|
|
||||||
# login
|
# login
|
||||||
sess = requests.Session()
|
r = requests.post(BASE_URL + 'usr',
|
||||||
r = sess.post(BASE_URL + 'usr',
|
data={"_st": "all",
|
||||||
data={"_st": "all",
|
"eml": MEMBERSHIPWORKS_USERNAME,
|
||||||
"eml": MEMBERSHIPWORKS_USERNAME,
|
"org": "10000",
|
||||||
"org": "10000",
|
"pwd": MEMBERSHIPWORKS_PASSWORD})
|
||||||
"pwd": MEMBERSHIPWORKS_PASSWORD})
|
|
||||||
SFtoken = r.json()['SF']
|
SFtoken = r.json()['SF']
|
||||||
|
|
||||||
# get list of member/staff IDs
|
# get list of member/staff IDs
|
||||||
r = sess.get(BASE_URL + "ylp",
|
r = requests.get(BASE_URL + "ylp",
|
||||||
params={"SF": SFtoken,
|
params={"SF": SFtoken,
|
||||||
"lbl": "5ae37979f033bfe8534f8799,5771675edcdf126302a2f6b9", # members and staff
|
"lbl": "5ae37979f033bfe8534f8799,5771675edcdf126302a2f6b9", # members and staff
|
||||||
"org": "15475", # unknown
|
"org": "15475", # unknown
|
||||||
"var": "_id,nam,ctc"})
|
"var": "_id,nam,ctc"})
|
||||||
ids = [user['_id'] for user in r.json()['usr']]
|
ids = [user['_id'] for user in r.json()['usr']]
|
||||||
|
|
||||||
# get members CSV
|
# get members CSV
|
||||||
# TODO: maybe can just use previous get instead? would return JSON
|
# 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},
|
params={"SF": SFtoken},
|
||||||
data={"_rt": "946702800", # unknown
|
data={"_rt": "946702800", # unknown
|
||||||
"mux": "", # unknown
|
"mux": "", # unknown
|
||||||
"tid": ",".join(ids), # ids of members to get
|
"tid": ",".join(ids), # ids of members to get
|
||||||
"var": "lvl,xws,xms,xsc,xrs,xfd,xac,phn,eml,lbl,nam"}) # which columns 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):
|
def makeMember(member, doorAuth):
|
||||||
"""Create an output CSV row for the member"""
|
"""Create an output CSV row for the member"""
|
||||||
|
Reference in New Issue
Block a user