-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathapp.py
51 lines (36 loc) · 1.26 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from __future__ import unicode_literals
import sys
from prompt_toolkit import prompt, AbortAction
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.contrib.completers import WordCompleter
import meetup.api
def get_names():
client = meetup.api.Client('3f6d3275d3b6314e73453c4aa27')
rsvps=client.GetRsvps(event_id='239174106', urlname='_ChiPy_')
member_id = ','.join([str(i['member']['member_id']) for i in rsvps.results])
members = client.GetMembers(member_id=member_id)
names = []
for member in members.results:
try:
names.append(member['name'])
except:
pass # ignore those who do not have a complete profile
return names
command_completer = WordCompleter(['add'], ignore_case=True)
def execute(command):
return "You issued:" + command
def main():
history = InMemoryHistory()
while True:
try:
text = prompt('> ',
completer = command_completer,
history=history,
on_abort=AbortAction.RETRY)
messages = execute(text)
print(messages)
except EOFError:
break # Control-D pressed.
print('GoodBye!')
if __name__ == '__main__':
main()