Compare commits
No commits in common. "97c4dbc1eedcd1e252d34abcec0ff2f1d6e4756c" and "c1430e2f9a53c36ffc04b95fabe6a1ce23407585" have entirely different histories.
97c4dbc1ee
...
c1430e2f9a
@ -2,7 +2,6 @@ import csv
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import datetime
|
|
||||||
|
|
||||||
BASE_URL = "https://api.membershipworks.com"
|
BASE_URL = "https://api.membershipworks.com"
|
||||||
|
|
||||||
@ -237,29 +236,3 @@ class MembershipWorks:
|
|||||||
fields = self._all_fields()
|
fields = self._all_fields()
|
||||||
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):
|
|
||||||
"""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()
|
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from .config import Config
|
|
||||||
from .MembershipWorks import MembershipWorks
|
|
||||||
|
|
||||||
|
|
||||||
def format_event(membershipworks: MembershipWorks, event):
|
|
||||||
event_details = membershipworks.get_event_by_eid(event["eid"])
|
|
||||||
url = (
|
|
||||||
"https://claremontmakerspace.org/events/#!event/register/"
|
|
||||||
+ event_details["url"]
|
|
||||||
)
|
|
||||||
if "lgo" in event_details:
|
|
||||||
img = f"""<img class="aligncenter" width="500" height="500" src="{event_details['lgo']['l']}">"""
|
|
||||||
else:
|
|
||||||
img = ""
|
|
||||||
# print(json.dumps(event_details))
|
|
||||||
return f"""<h2 style="text-align: center;">
|
|
||||||
<a href="{url}">
|
|
||||||
{img}
|
|
||||||
{event_details['ttl']}
|
|
||||||
</a>
|
|
||||||
</h2>
|
|
||||||
<div>{event_details['szp']} — {event_details['ezp']}</div>
|
|
||||||
<div>
|
|
||||||
{event_details['dtl']}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a href="{url}">Register for this class now!</a>"""
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
config = Config()
|
|
||||||
|
|
||||||
membershipworks = config.membershipworks
|
|
||||||
events = membershipworks.get_events_list(datetime.now())
|
|
||||||
events_list = "\n<hr />\n\n".join(
|
|
||||||
format_event(membershipworks, event)
|
|
||||||
for event in events["evt"]
|
|
||||||
if event["ttl"] != "[TEMPLATE FOR COPYING]"
|
|
||||||
)
|
|
||||||
header = """<p><img class="aligncenter size-medium wp-image-2319" src="https://claremontmakerspace.org/wp-content/uploads/2019/03/CMS-Logo-b-y-g-300x168.png" alt="" width="300" height="168" /></a></p>
|
|
||||||
<p>Greetings Upper Valley Makers:</p>
|
|
||||||
<p>We have an exciting list of upcoming classes at the Claremont Makerspace that we think might interest you.</p>
|
|
||||||
<strong>For most classes and events, CMS MEMBERSHIP IS NOT REQUIRED.</strong> That said, members receive a discount on registration and there are some classes/events that are for members only (this will be clearly noted in the event description).
|
|
||||||
|
|
||||||
<strong>Class policies</strong> (liability waiver, withdrawal, cancellation, etc.) can be found <a href="https://claremontmakerspace.org/class-policies/" data-wpel-link="internal">here</a>.
|
|
||||||
|
|
||||||
<strong>Please note: </strong>The Claremont MakerSpace currently requires masks for all visitors and members.
|
|
||||||
|
|
||||||
<strong>Instructors:</strong> Interested in teaching a class at CMS? Please fill out our <a href="https://docs.google.com/forms/d/e/1FAIpQLSdJyEVRJxzIczG784VkOm_DsNyv-VXRXYzlis8qlMdEOvHGpQ/viewform" target="_blank" rel="noreferrer noopener external" data-wpel-link="external">Class Proposal Form</a><a href="https://docs.google.com/forms/d/e/1FAIpQLSdJyEVRJxzIczG784VkOm_DsNyv-VXRXYzlis8qlMdEOvHGpQ/viewform" target="_blank" rel="noreferrer noopener external" data-wpel-link="external">.</a>
|
|
||||||
|
|
||||||
<strong>Tours:</strong> Want to see what the Claremont MakerSpace is all about? Tours are by appointment only due to COVID-19 restrictions. <a href="https://tickets.claremontmakerspace.org/open.php" target="_blank" rel="noreferrer noopener external" data-wpel-link="external">Contact Us</a> to schedule your tour where you can learn about all the awesome tools that the CMS offers access to, as well as how membership, classes, and studio spaces work.
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
"""
|
|
||||||
|
|
||||||
footer = """
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<div>Happy Makin’!</div>
|
|
||||||
<div>We are grateful for all of the public support that our 501(c)(3), non-profit organization receives. If you’d like to make a donation,please visit the <a href="https://claremontmakerspace.org/support/"><strong>Support Us page</strong></a>of our website.</div>
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
|
|
||||||
print(header, events_list, footer)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
@ -33,7 +33,6 @@ doorUpdater = 'memberPlumbing.doorUpdater:main'
|
|||||||
hidEvents = 'memberPlumbing.hidEvents:main'
|
hidEvents = 'memberPlumbing.hidEvents:main'
|
||||||
sqlExport = 'memberPlumbing.sqlExport:main'
|
sqlExport = 'memberPlumbing.sqlExport:main'
|
||||||
ucsAccounts = 'memberPlumbing.ucsAccounts:main'
|
ucsAccounts = 'memberPlumbing.ucsAccounts:main'
|
||||||
upcomingEvents = 'memberPlumbing.upcomingEvents:main'
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry>=0.12"]
|
requires = ["poetry>=0.12"]
|
||||||
|
Reference in New Issue
Block a user