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()))
|
members = self.get_members(folders, ",".join(fields.keys()))
|
||||||
return members
|
return members
|
||||||
|
|
||||||
def get_events_list(self, start_date: datetime.datetime):
|
def get_events_list(
|
||||||
"""Retrive a list of events since start_date"""
|
self,
|
||||||
r = self.sess.get(
|
start_date: datetime.datetime = None,
|
||||||
BASE_URL + "/v2/events",
|
end_date: datetime.datetime = None,
|
||||||
params={
|
categories=False,
|
||||||
"sdp": start_date.strftime("%s"),
|
):
|
||||||
},
|
"""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()
|
return r.json()
|
||||||
|
|
||||||
def get_event_by_eid(self, eid: str):
|
def get_event_by_eid(self, eid: str):
|
||||||
|
Loading…
Reference in New Issue
Block a user