forked from CMS/memberPlumbing
MembershipWorks: Add methods to get event listing and events by eid/url
This commit is contained in:
parent
c1430e2f9a
commit
3595a24d85
@ -2,6 +2,7 @@ import csv
|
||||
from io import StringIO
|
||||
|
||||
import requests
|
||||
import datetime
|
||||
|
||||
BASE_URL = "https://api.membershipworks.com"
|
||||
|
||||
@ -236,3 +237,29 @@ class MembershipWorks:
|
||||
fields = self._all_fields()
|
||||
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"),
|
||||
},
|
||||
)
|
||||
return r.json()
|
||||
|
||||
def get_event_by_eid(self, eid: str):
|
||||
"""Retrieve a specific event by its event id (eid)"""
|
||||
r = self.sess.get(
|
||||
BASE_URL + "/v2/event",
|
||||
params={"eid": eid},
|
||||
)
|
||||
return r.json()
|
||||
|
||||
def get_event_by_url(self, url: str):
|
||||
"""Retrieve a specific event by its url"""
|
||||
r = self.sess.get(
|
||||
BASE_URL + "/v2/event",
|
||||
params={"url": url},
|
||||
)
|
||||
return r.json()
|
||||
|
Loading…
Reference in New Issue
Block a user