Annotate API scripts.
This commit is contained in:
parent
28b697ac9d
commit
43bf07bf15
3 changed files with 13 additions and 4 deletions
|
@ -27,12 +27,18 @@ import os
|
|||
import optparse
|
||||
import logging
|
||||
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
import zulip
|
||||
|
||||
logging.basicConfig()
|
||||
|
||||
log = logging.getLogger('zulip-send')
|
||||
|
||||
def do_send_message(client, message_data ):
|
||||
# type: (zulip.Client, Dict[str, Any]) -> bool
|
||||
'''Sends a message and optionally prints status about the same.'''
|
||||
|
||||
if message_data['type'] == 'stream':
|
||||
|
@ -49,6 +55,7 @@ def do_send_message(client, message_data ):
|
|||
return False
|
||||
|
||||
def main(argv=None):
|
||||
# type: (Optional[List[str]]) -> int
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
||||
|
@ -63,10 +70,6 @@ def main(argv=None):
|
|||
'--user' and '--api-key' arguments.
|
||||
"""
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
||||
# Grab parser options from the API common set
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue