-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzuuulip.py
51 lines (31 loc) · 997 Bytes
/
zuuulip.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
#!/usr/bin/env python3
import zulip
c = zulip.Client()
# Get the 3 last messages sent by "iago@zulip.com" to the stream "Verona"
request = {
'use_first_unread_anchor': True,
'num_before': 100,
'num_after': 10,
'narrow': [{'operator': 'stream', 'operand': 'remote'},
{'operator': 'topic', 'operand': 'Anti-Überwachungs-Router'}],
'apply_markdown': False
}
messages = c.get_messages(request)['messages']
for message in messages:
print("{}: {}".format(message['sender_full_name'], message['content']))
message = {
"type": "stream",
"to": 'remote',
"subject": "Anti-Überwachungs-Router",
"content": "api-test für morgen",
}
#x = c.send_message(message)
exit()
streams = c.get_streams()['streams']
for stream in streams:
print(stream['name'], stream['stream_id'])
stream_id = 56
print("Lets get the topics\n\n\n")
topics = c.get_stream_topics(stream_id)['topics']
for topic in topics:
print(topic['name'], topic['max_id'])