membershipworks: Allow get_events_list to use end date, retrieve categories
This commit is contained in:
parent
08dde9a4f4
commit
546b13428e
@ -238,14 +238,25 @@ class MembershipWorks:
|
||||
members = self.get_members(folders, ",".join(fields.keys()))
|
||||
return members
|
||||
|
||||
def get_events_list(self, start_date: datetime.datetime):
|
||||
"""Retrive a list of events since start_date"""
|
||||
r = self.sess.get(
|
||||
BASE_URL + "/v2/events",
|
||||
params={
|
||||
"sdp": start_date.strftime("%s"),
|
||||
},
|
||||
)
|
||||
def get_events_list(
|
||||
self,
|
||||
start_date: datetime.datetime = None,
|
||||
end_date: datetime.datetime = None,
|
||||
categories=False,
|
||||
):
|
||||
"""Retrive a list of events between `start_date` and `end_date`, optionally including category information"""
|
||||
if start_date is None and end_date is None:
|
||||
raise ValueError("Must specify one of start_date or end_date")
|
||||
|
||||
params = {}
|
||||
if start_date is not None:
|
||||
params["sdp"] = start_date.strftime("%s")
|
||||
if end_date is not None:
|
||||
params["edp"] = end_date.strftime("%s")
|
||||
if categories is not None:
|
||||
params["_st"] = ""
|
||||
|
||||
r = self.sess.get(BASE_URL + "/v2/events", params=params)
|
||||
return r.json()
|
||||
|
||||
def get_event_by_eid(self, eid: str):
|
||||
|
Loading…
Reference in New Issue
Block a user