diff --git a/memberPlumbing/upcomingEvents.py b/memberPlumbing/upcomingEvents.py new file mode 100644 index 0000000..d90252e --- /dev/null +++ b/memberPlumbing/upcomingEvents.py @@ -0,0 +1,72 @@ +#!/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"""""" + else: + img = "" + # print(json.dumps(event_details)) + return f"""

+ + {img} + {event_details['ttl']} + +

+
{event_details['szp']} — {event_details['ezp']}
+
+ {event_details['dtl']} +
+ +Register for this class now!""" + + +def main(): + config = Config() + + membershipworks = config.membershipworks + events = membershipworks.get_events_list(datetime.now()) + events_list = "\n
\n\n".join( + format_event(membershipworks, event) + for event in events["evt"] + if event["ttl"] != "[TEMPLATE FOR COPYING]" + ) + header = """

+

Greetings Upper Valley Makers:

+

We have an exciting list of upcoming classes at the Claremont Makerspace that we think might interest you.

+For most classes and events, CMS MEMBERSHIP IS NOT REQUIRED. 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). + +Class policies (liability waiver, withdrawal, cancellation, etc.) can be found here. + +Please note: The Claremont MakerSpace currently requires masks for all visitors and members. + +Instructors: Interested in teaching a class at CMS? Please fill out our Class Proposal Form. + +Tours: Want to see what the Claremont MakerSpace is all about? Tours are by appointment only due to COVID-19 restrictions. Contact Us 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. + +
+""" + + footer = """ +
+ +
Happy Makin’!
+
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 Support Us pageof our website.
+ +""" + + print(header, events_list, footer) + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml index 29f1efc..63e18a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ doorUpdater = 'memberPlumbing.doorUpdater:main' hidEvents = 'memberPlumbing.hidEvents:main' sqlExport = 'memberPlumbing.sqlExport:main' ucsAccounts = 'memberPlumbing.ucsAccounts:main' +upcomingEvents = 'memberPlumbing.upcomingEvents:main' [build-system] requires = ["poetry>=0.12"]