def event_answers(event_id):
    """Return a dict mapping {"yes","no","maybe"} onto (username, num_guests) pairs."""
    answers = defaultdict(list)
    rsvps = meetup("2/rsvps", event_id=event_id)
    for rsvp in rsvps:
        answers[rsvp['response']].append((rsvp['member']['name'], rsvp['guests']))
    return answers
def list_events(**kwargs):
    """Return a list of events, from the 2/events Meetup API call."""
    kwargs.setdefault('group_id', GROUP_ID)
    events = meetup("2/events", **kwargs)
    for event in events:
        event['when'] = time.strftime("%d %b %Y", time.localtime(event['time']//1000))
    return events
def event_attendees(event_id):
    """Return the set of attendees in the yes or waiting list."""
    rsvps = meetup("2/rsvps", event_id=event_id)
    attendees = set()
    for rsvp in rsvps:
        if rsvp['response'] in ['yes', 'waitlist']:
            member = rsvp['member']
            attendees.add((member['member_id'], member['name']))
    return attendees
Exemple #4
0
def group_members(**kwargs):
    """Return a list of the members of a group."""
    members = meetup.meetup("members", **kwargs)
    for m in members:
        last_visit = time.strptime(m['visited'][:-4], "%Y-%m-%d %H:%M:%S")
        m['visitage'] = time.time() - time.mktime(last_visit)
        joined = time.strptime(m['joined'].replace("EDT ", "").replace("EST ", ""), "%a %b %d %H:%M:%S %Y")
        m['joinage'] = time.time() - time.mktime(joined)
    return members
Exemple #5
0
def group_members(**kwargs):
    """Return a list of the members of a group."""
    members = meetup.meetup("members", **kwargs)
    for m in members:
        last_visit = time.strptime(m['visited'][:-4], "%Y-%m-%d %H:%M:%S")
        m['visitage'] = time.time() - time.mktime(last_visit)
        joined = time.strptime(m['joined'].replace("EDT ", "").replace("EST ", ""), "%a %b %d %H:%M:%S %Y")
        m['joinage'] = time.time() - time.mktime(joined)
        all_names.add(m['name'].lower())
        gend = guess_gender(m['name'])
        if gend not in ['male', 'female']:
            unknown_names.add(m['name'].lower())
            gend = "unknown"
        m['gender'] = gend
    return members
 def test_second_tuesday_of_may_2013(self):
     self.assertEqual(meetup(2013, 5, "2nd", "Tuesday"), date(2013, 5, 14))
 def test_second_wednesday_of_july_2013(self):
     self.assertEqual(meetup(2013, 7, "2nd", "Wednesday"),
                      date(2013, 7, 10))
 def test_tuesteenth_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "teenth", "Tuesday"),
                      date(2013, 3, 19))
Exemple #9
0
 def test_last_wednesday_of_december_2014(self):
     self.assertEqual(
         meetup(2014, 12, 'last', 'Wednesday'), date(2014, 12, 31))
Exemple #10
0
 def test_second_sunday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "2nd", "Sunday"), date(2013, 4, 14))
Exemple #11
0
 def test_first_friday_of_december_2012(self):
     self.assertEqual(
         meetup(2012, 12, '1st', 'Friday'), date(2012, 12, 7))
Exemple #12
0
 def test_thursteenth_of_september_2013(self):
     self.assertEqual(
         meetup(2013, 9, 'teenth', 'Thursday'), date(2013, 9, 19))
Exemple #13
0
 def test_second_saturday_of_january_2013(self):
     self.assertEqual(meetup(2013, 1, "2nd", "Saturday"), date(2013, 1, 12))
Exemple #14
0
 def test_thursteenth_of_may_2013(self):
     self.assertEqual(
         meetup(2013, 5, 'teenth', 'Thursday'), date(2013, 5, 16))
Exemple #15
0
 def test_thursteenth_of_june_2013(self):
     self.assertEqual(
         meetup(2013, 6, 'teenth', 'Thursday'), date(2013, 6, 13))
Exemple #16
0
 def test_wednesteenth_of_june_2013(self):
     self.assertEqual(
         meetup(2013, 6, 'teenth', 'Wednesday'), date(2013, 6, 19))
Exemple #17
0
 def test_nonexistent_fifth_monday_of_february_2015(self):
     with self.assertRaisesWithMessage(MeetupDayException):
         meetup(2015, 2, '5th', 'Monday')
Exemple #18
0
 def test_fifth_monday_of_march_2015(self):
     self.assertEqual(
         meetup(2015, 3, '5th', 'Monday'), date(2015, 3, 30))
Exemple #19
0
 def test_second_thursday_of_september_2013(self):
     self.assertEqual(meetup(2013, 9, "2nd", "Thursday"), date(2013, 9, 12))
Exemple #20
0
 def test_friteenth_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, 'teenth', 'Friday'), date(2013, 4, 19))
Exemple #21
0
 def test_second_friday_of_november_2013(self):
     self.assertEqual(meetup(2013, 11, "2nd", "Friday"), date(2013, 11, 8))
Exemple #22
0
 def test_friteenth_of_august_2013(self):
     self.assertEqual(
         meetup(2013, 8, 'teenth', 'Friday'), date(2013, 8, 16))
Exemple #23
0
 def test_second_saturday_of_february_2013(self):
     self.assertEqual(meetup(2013, 2, "2nd", "Saturday"), date(2013, 2, 9))
Exemple #24
0
 def test_friteenth_of_september_2013(self):
     self.assertEqual(
         meetup(2013, 9, 'teenth', 'Friday'), date(2013, 9, 13))
Exemple #25
0
 def test_third_monday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "3rd", "Monday"), date(2013, 4, 15))
Exemple #26
0
 def test_saturteenth_of_february_2013(self):
     self.assertEqual(
         meetup(2013, 2, 'teenth', 'Saturday'), date(2013, 2, 16))
Exemple #27
0
 def test_third_thursday_of_october_2013(self):
     self.assertEqual(meetup(2013, 10, "3rd", "Thursday"),
                      date(2013, 10, 17))
Exemple #28
0
 def test_saturteenth_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, 'teenth', 'Saturday'), date(2013, 4, 13))
Exemple #29
0
 def test_third_saturday_of_january_2013(self):
     self.assertEqual(meetup(2013, 1, "3rd", "Saturday"), date(2013, 1, 19))
Exemple #30
0
 def test_saturteenth_of_october_2013(self):
     self.assertEqual(
         meetup(2013, 10, 'teenth', 'Saturday'), date(2013, 10, 19))
Exemple #31
0
 def test_second_monday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "2nd", "Monday"), date(2013, 4, 8))
Exemple #32
0
 def test_sunteenth_of_may_2013(self):
     self.assertEqual(
         meetup(2013, 5, 'teenth', 'Sunday'), date(2013, 5, 19))
Exemple #33
0
 def test_second_tuesday_of_june_2013(self):
     self.assertEqual(meetup(2013, 6, "2nd", "Tuesday"), date(2013, 6, 11))
Exemple #34
0
 def test_sunteenth_of_june_2013(self):
     self.assertEqual(
         meetup(2013, 6, 'teenth', 'Sunday'), date(2013, 6, 16))
Exemple #35
0
 def test_second_wednesday_of_august_2013(self):
     self.assertEqual(meetup(2013, 8, "2nd", "Wednesday"),
                      date(2013, 8, 14))
Exemple #36
0
 def test_sunteenth_of_october_2013(self):
     self.assertEqual(
         meetup(2013, 10, 'teenth', 'Sunday'), date(2013, 10, 13))
Exemple #37
0
 def test_second_thursday_of_october_2013(self):
     self.assertEqual(meetup(2013, 10, "2nd", "Thursday"),
                      date(2013, 10, 10))
Exemple #38
0
 def test_monteenth_of_may_2013(self):
     self.assertEqual(
         meetup(2013, 5, 'teenth', 'Monday'), date(2013, 5, 13))
Exemple #39
0
 def test_second_friday_of_december_2013(self):
     self.assertEqual(meetup(2013, 12, "2nd", "Friday"), date(2013, 12, 13))
Exemple #40
0
 def test_first_monday_of_march_2013(self):
     self.assertEqual(
         meetup(2013, 3, '1st', 'Monday'), date(2013, 3, 4))
Exemple #41
0
 def test_monteenth_of_september_2013(self):
     self.assertEqual(meetup(2013, 9, "teenth", "Monday"),
                      date(2013, 9, 16))
Exemple #42
0
 def test_first_monday_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, '1st', 'Monday'), date(2013, 4, 1))
Exemple #43
0
 def test_second_sunday_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "2nd", "Sunday"), date(2013, 3, 10))
Exemple #44
0
 def test_third_tuesday_of_june_2013(self):
     self.assertEqual(meetup(2013, 6, "3rd", "Tuesday"), date(2013, 6, 18))
Exemple #45
0
 def test_third_monday_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "3rd", "Monday"), date(2013, 3, 18))
Exemple #46
0
 def test_third_wednesday_of_august_2013(self):
     self.assertEqual(meetup(2013, 8, "3rd", "Wednesday"),
                      date(2013, 8, 21))
Exemple #47
0
 def test_third_tuesday_of_may_2013(self):
     self.assertEqual(meetup(2013, 5, "3rd", "Tuesday"), date(2013, 5, 21))
Exemple #48
0
 def test_last_sunday_of_february_2015(self):
     self.assertEqual(
         meetup(2015, 2, 'last', 'Sunday'), date(2015, 2, 22))
Exemple #49
0
 def test_third_wednesday_of_july_2013(self):
     self.assertEqual(meetup(2013, 7, "3rd", "Wednesday"),
                      date(2013, 7, 17))
Exemple #50
0
 def test_first_saturday_of_february_2013(self):
     self.assertEqual(meetup(2013, 2, "1st", "Saturday"), date(2013, 2, 2))
Exemple #51
0
 def test_third_thursday_of_september_2013(self):
     self.assertEqual(meetup(2013, 9, "3rd", "Thursday"), date(2013, 9, 19))
Exemple #52
0
 def test_monteenth_of_august_2013(self):
     self.assertEqual(meetup(2013, 8, "teenth", "Monday"),
                      date(2013, 8, 19))
Exemple #53
0
 def test_third_friday_of_november_2013(self):
     self.assertEqual(meetup(2013, 11, "3rd", "Friday"), date(2013, 11, 15))
Exemple #54
0
 def test_wednesteenth_of_february_2013(self):
     self.assertEqual(
         meetup(2013, 2, 'teenth', 'Wednesday'), date(2013, 2, 13))
Exemple #55
0
 def test_third_friday_of_december_2013(self):
     self.assertEqual(meetup(2013, 12, "3rd", "Friday"), date(2013, 12, 20))
Exemple #56
0
 def test_last_sunday_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, 'last', 'Sunday'), date(2013, 4, 28))
Exemple #57
0
 def test_first_sunday_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "1st", "Sunday"), date(2013, 3, 3))
Exemple #58
0
 def test_last_wednesday_of_february_2012(self):
     self.assertEqual(
         meetup(2012, 2, 'last', 'Wednesday'), date(2012, 2, 29))
Exemple #59
0
 def test_first_sunday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "1st", "Sunday"), date(2013, 4, 7))
Exemple #60
0
 def test_last_sunday_of_march_2013(self):
     self.assertEqual(
         meetup(2013, 3, 'last', 'Sunday'), date(2013, 3, 31))