Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 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
Esempio n. 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
Esempio n. 6
0
 def test_second_tuesday_of_may_2013(self):
     self.assertEqual(meetup(2013, 5, "2nd", "Tuesday"), date(2013, 5, 14))
Esempio n. 7
0
 def test_second_wednesday_of_july_2013(self):
     self.assertEqual(meetup(2013, 7, "2nd", "Wednesday"),
                      date(2013, 7, 10))
Esempio n. 8
0
 def test_tuesteenth_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "teenth", "Tuesday"),
                      date(2013, 3, 19))
Esempio n. 9
0
 def test_last_wednesday_of_december_2014(self):
     self.assertEqual(
         meetup(2014, 12, 'last', 'Wednesday'), date(2014, 12, 31))
Esempio n. 10
0
 def test_second_sunday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "2nd", "Sunday"), date(2013, 4, 14))
Esempio n. 11
0
 def test_first_friday_of_december_2012(self):
     self.assertEqual(
         meetup(2012, 12, '1st', 'Friday'), date(2012, 12, 7))
Esempio n. 12
0
 def test_thursteenth_of_september_2013(self):
     self.assertEqual(
         meetup(2013, 9, 'teenth', 'Thursday'), date(2013, 9, 19))
Esempio n. 13
0
 def test_second_saturday_of_january_2013(self):
     self.assertEqual(meetup(2013, 1, "2nd", "Saturday"), date(2013, 1, 12))
Esempio n. 14
0
 def test_thursteenth_of_may_2013(self):
     self.assertEqual(
         meetup(2013, 5, 'teenth', 'Thursday'), date(2013, 5, 16))
Esempio n. 15
0
 def test_thursteenth_of_june_2013(self):
     self.assertEqual(
         meetup(2013, 6, 'teenth', 'Thursday'), date(2013, 6, 13))
Esempio n. 16
0
 def test_wednesteenth_of_june_2013(self):
     self.assertEqual(
         meetup(2013, 6, 'teenth', 'Wednesday'), date(2013, 6, 19))
Esempio n. 17
0
 def test_nonexistent_fifth_monday_of_february_2015(self):
     with self.assertRaisesWithMessage(MeetupDayException):
         meetup(2015, 2, '5th', 'Monday')
Esempio n. 18
0
 def test_fifth_monday_of_march_2015(self):
     self.assertEqual(
         meetup(2015, 3, '5th', 'Monday'), date(2015, 3, 30))
Esempio n. 19
0
 def test_second_thursday_of_september_2013(self):
     self.assertEqual(meetup(2013, 9, "2nd", "Thursday"), date(2013, 9, 12))
Esempio n. 20
0
 def test_friteenth_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, 'teenth', 'Friday'), date(2013, 4, 19))
Esempio n. 21
0
 def test_second_friday_of_november_2013(self):
     self.assertEqual(meetup(2013, 11, "2nd", "Friday"), date(2013, 11, 8))
Esempio n. 22
0
 def test_friteenth_of_august_2013(self):
     self.assertEqual(
         meetup(2013, 8, 'teenth', 'Friday'), date(2013, 8, 16))
Esempio n. 23
0
 def test_second_saturday_of_february_2013(self):
     self.assertEqual(meetup(2013, 2, "2nd", "Saturday"), date(2013, 2, 9))
Esempio n. 24
0
 def test_friteenth_of_september_2013(self):
     self.assertEqual(
         meetup(2013, 9, 'teenth', 'Friday'), date(2013, 9, 13))
Esempio n. 25
0
 def test_third_monday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "3rd", "Monday"), date(2013, 4, 15))
Esempio n. 26
0
 def test_saturteenth_of_february_2013(self):
     self.assertEqual(
         meetup(2013, 2, 'teenth', 'Saturday'), date(2013, 2, 16))
Esempio n. 27
0
 def test_third_thursday_of_october_2013(self):
     self.assertEqual(meetup(2013, 10, "3rd", "Thursday"),
                      date(2013, 10, 17))
Esempio n. 28
0
 def test_saturteenth_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, 'teenth', 'Saturday'), date(2013, 4, 13))
Esempio n. 29
0
 def test_third_saturday_of_january_2013(self):
     self.assertEqual(meetup(2013, 1, "3rd", "Saturday"), date(2013, 1, 19))
Esempio n. 30
0
 def test_saturteenth_of_october_2013(self):
     self.assertEqual(
         meetup(2013, 10, 'teenth', 'Saturday'), date(2013, 10, 19))
Esempio n. 31
0
 def test_second_monday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "2nd", "Monday"), date(2013, 4, 8))
Esempio n. 32
0
 def test_sunteenth_of_may_2013(self):
     self.assertEqual(
         meetup(2013, 5, 'teenth', 'Sunday'), date(2013, 5, 19))
Esempio n. 33
0
 def test_second_tuesday_of_june_2013(self):
     self.assertEqual(meetup(2013, 6, "2nd", "Tuesday"), date(2013, 6, 11))
Esempio n. 34
0
 def test_sunteenth_of_june_2013(self):
     self.assertEqual(
         meetup(2013, 6, 'teenth', 'Sunday'), date(2013, 6, 16))
Esempio n. 35
0
 def test_second_wednesday_of_august_2013(self):
     self.assertEqual(meetup(2013, 8, "2nd", "Wednesday"),
                      date(2013, 8, 14))
Esempio n. 36
0
 def test_sunteenth_of_october_2013(self):
     self.assertEqual(
         meetup(2013, 10, 'teenth', 'Sunday'), date(2013, 10, 13))
Esempio n. 37
0
 def test_second_thursday_of_october_2013(self):
     self.assertEqual(meetup(2013, 10, "2nd", "Thursday"),
                      date(2013, 10, 10))
Esempio n. 38
0
 def test_monteenth_of_may_2013(self):
     self.assertEqual(
         meetup(2013, 5, 'teenth', 'Monday'), date(2013, 5, 13))
Esempio n. 39
0
 def test_second_friday_of_december_2013(self):
     self.assertEqual(meetup(2013, 12, "2nd", "Friday"), date(2013, 12, 13))
Esempio n. 40
0
 def test_first_monday_of_march_2013(self):
     self.assertEqual(
         meetup(2013, 3, '1st', 'Monday'), date(2013, 3, 4))
Esempio n. 41
0
 def test_monteenth_of_september_2013(self):
     self.assertEqual(meetup(2013, 9, "teenth", "Monday"),
                      date(2013, 9, 16))
Esempio n. 42
0
 def test_first_monday_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, '1st', 'Monday'), date(2013, 4, 1))
Esempio n. 43
0
 def test_second_sunday_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "2nd", "Sunday"), date(2013, 3, 10))
Esempio n. 44
0
 def test_third_tuesday_of_june_2013(self):
     self.assertEqual(meetup(2013, 6, "3rd", "Tuesday"), date(2013, 6, 18))
Esempio n. 45
0
 def test_third_monday_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "3rd", "Monday"), date(2013, 3, 18))
Esempio n. 46
0
 def test_third_wednesday_of_august_2013(self):
     self.assertEqual(meetup(2013, 8, "3rd", "Wednesday"),
                      date(2013, 8, 21))
Esempio n. 47
0
 def test_third_tuesday_of_may_2013(self):
     self.assertEqual(meetup(2013, 5, "3rd", "Tuesday"), date(2013, 5, 21))
Esempio n. 48
0
 def test_last_sunday_of_february_2015(self):
     self.assertEqual(
         meetup(2015, 2, 'last', 'Sunday'), date(2015, 2, 22))
Esempio n. 49
0
 def test_third_wednesday_of_july_2013(self):
     self.assertEqual(meetup(2013, 7, "3rd", "Wednesday"),
                      date(2013, 7, 17))
Esempio n. 50
0
 def test_first_saturday_of_february_2013(self):
     self.assertEqual(meetup(2013, 2, "1st", "Saturday"), date(2013, 2, 2))
Esempio n. 51
0
 def test_third_thursday_of_september_2013(self):
     self.assertEqual(meetup(2013, 9, "3rd", "Thursday"), date(2013, 9, 19))
Esempio n. 52
0
 def test_monteenth_of_august_2013(self):
     self.assertEqual(meetup(2013, 8, "teenth", "Monday"),
                      date(2013, 8, 19))
Esempio n. 53
0
 def test_third_friday_of_november_2013(self):
     self.assertEqual(meetup(2013, 11, "3rd", "Friday"), date(2013, 11, 15))
Esempio n. 54
0
 def test_wednesteenth_of_february_2013(self):
     self.assertEqual(
         meetup(2013, 2, 'teenth', 'Wednesday'), date(2013, 2, 13))
Esempio n. 55
0
 def test_third_friday_of_december_2013(self):
     self.assertEqual(meetup(2013, 12, "3rd", "Friday"), date(2013, 12, 20))
Esempio n. 56
0
 def test_last_sunday_of_april_2013(self):
     self.assertEqual(
         meetup(2013, 4, 'last', 'Sunday'), date(2013, 4, 28))
Esempio n. 57
0
 def test_first_sunday_of_march_2013(self):
     self.assertEqual(meetup(2013, 3, "1st", "Sunday"), date(2013, 3, 3))
Esempio n. 58
0
 def test_last_wednesday_of_february_2012(self):
     self.assertEqual(
         meetup(2012, 2, 'last', 'Wednesday'), date(2012, 2, 29))
Esempio n. 59
0
 def test_first_sunday_of_april_2013(self):
     self.assertEqual(meetup(2013, 4, "1st", "Sunday"), date(2013, 4, 7))
Esempio n. 60
0
 def test_last_sunday_of_march_2013(self):
     self.assertEqual(
         meetup(2013, 3, 'last', 'Sunday'), date(2013, 3, 31))