Logo

ThaiPy - Bangkok Python Meetup

Monthly meetup for those interested in python, the most popular language in the world.

Visit our Meetup Page
Visit our GitHub Profile

Next meetup

Every 3rd Thursday - Join Us RSVP

packages = ["python-dateutil", "BeautifulSoup4", "requests"] [splashscreen] enabled = false #[[fetch]] #from = 'https://openrss.org/www.meetup.com/thaipy-bangkok-python-meetup/' #from = "https://www.meetup.com/thaipy-bangkok-python-meetup/" #files = ["events"] import asyncio from datetime import datetime as dt import calendar import json import requests from dateutil.relativedelta import relativedelta from dateutil.parser import parse from pyodide.http import pyfetch from js import console import datetime now = dt.now().astimezone() async def get_next_event(): CORS_PROXY = "https://corsproxy.io/?" # page = await pyfetch(CORS_PROXY+"https://openrss.org/www.meetup.com/thaipy-bangkok-python-meetup/events/", # headers={"Accept": "application/rss+xml"}, mode="no-cors") url = CORS_PROXY+"https://www.meetup.com/thaipy-bangkok-python-meetup/events/" console.log(url) page = await pyfetch(url, mode="cors") text = (await page.bytes()).decode("utf8") top, rest = text.split('", 1) data = json.loads(script) props = data['props']['pageProps']['__APOLLO_STATE__'] withdates = (p for p in props.values() if hasattr(p, 'get') and p.get(u'dateTime')) nextdate = sorted((parse(p['dateTime']),p['title']) for p in withdates)[0] return nextdate async def get_next_repeat(): next_date = calendar.Calendar(3).monthdatescalendar(now.year, now.month)[3][0] if next_date < now.date(): next_date = calendar.Calendar(3).monthdatescalendar(now.year, now.month+1)[3][0] return (dt(next_date.year, next_date.month, next_date.day, 18, 30, 0, tzinfo=datetime.timezone(datetime.timedelta(hours=7))), "") def humanise_timedelta(td): time_arr = [] if td.months: time_arr.append(f"{td.months} month{'' if td.months == 1 else 's'}") if td.days: time_arr.append(f"{td.days} day{'' if td.days == 1 else 's'}") if td.hours: time_arr.append(f"{td.hours} hour{'' if td.hours == 1 else 's'}") if td.minutes: time_arr.append(f"{td.minutes} minute{'' if td.minutes == 1 else 's'}") if td.seconds: time_arr.append(f"{td.seconds} second{'' if td.seconds == 1 else 's'}") return " ".join(time_arr) async def main(): try: next_date, next_event = await get_next_event() except Exception as e: console.log(str(e)) next_date, next_event = await get_next_repeat() output_year = f"{next_date.strftime('%a %b %d')}" Element("newdate").write(output_year) while True: td = relativedelta(next_date, dt.now().astimezone()) Element("showtime").write("- in " + humanise_timedelta(td)) Element("title").write(next_event) await asyncio.sleep(1) asyncio.ensure_future(main()) # Feeds -

Code of Conduct

The ThaiPy meetup is dedicated to providing a harassment-free community for everyone, regardless of sex, gender identity or expression, sexual orientation, disability, physical appearance, age, body size, race, nationality, or religious beliefs. We do not tolerate harassment of community members in any form. Participants violating these rules may be sanctioned or expelled from the community at the discretion of the ThaiPy organisers.

Harassment includes offensive verbal or written comments related to sex, gender identity or expression, sexual orientation, disability, physical appearance, age, body size, race, nationality, or religious beliefs, deliberate intimidation, threats, stalking, following, harassing photography or recording, sustained disruption of talks or other events, inappropriate physical contact, and unwelcome sexual attention. Sexual language and imagery is not appropriate for any ThaiPy event or communication channel.

Community members are not to use ThaiPy meetings or communication channels in order to proposition any other member.

Community members asked to stop any harassing behaviour are expected to comply immediately. Sponsors and presenters are also subject to the anti-harassment policy.

If a community member engages in harassing behaviour, the ThaiPy organisers may take any action they deem appropriate, including warning the offender or expulsion from the ThaiPy community. If you are being harassed please contact a ThaiPy organiser immediately. If you notice that someone else is being harassed please intercede or contact an ThaiPy organiser immediately. If you have any other concerns, please contact an ThaiPy organiser.

ThaiPy organisers may, at their discretion, treat breaches of our code of conduct in other communities as if they occurred within ThaiPy-run community events. Patterns of behaviour within peer groups of ThaiPy will be treated as if they occurred within ThaiPy.

ThaiPy organisers may, at their discretion, notify peer groups of breaches of our code of conduct if deemed appropriate.

Reporting guidelines

Contact Info

Website: thaipy.github.io

Email: thaipy@dylanjay.com

If you have questions or feedback about this Code of Conduct please contact one of the organisers.

ThaiPy organisers developed this Code of Conduct to govern all ThaiPy events and communication channels. We used the PDX Python code of conduct as a guide, itself influenced by the Geek Feminism Conference anti-harassment policy as a starting point. This Code of Conduct, like its inspirations, is licensed under the Creative Commons — CC0 1.0 Universal license.