From 86729a862cf7148d20e01235097a4a6a164d7d20 Mon Sep 17 00:00:00 2001 From: derAnfaenger Date: Fri, 25 Aug 2017 11:03:06 +0200 Subject: [PATCH] api: Remove unnecessary API key details. Fixes #1. --- zulip/examples/create-user | 4 +++- zulip/examples/edit-message | 6 +++--- zulip/examples/get-public-streams | 6 +++--- zulip/examples/list-members | 6 ++++-- zulip/examples/list-subscriptions | 6 +++--- zulip/examples/print-events | 6 +++--- zulip/examples/print-messages | 6 +++--- zulip/examples/recent-messages | 8 ++++---- zulip/examples/subscribe | 8 ++++---- zulip/examples/unsubscribe | 8 ++++---- zulip/examples/upload-file | 6 +++--- zulip/integrations/google/google-calendar | 6 +++--- zulip/integrations/irc/irc-mirror.py | 6 +++--- zulip/zulip/send.py | 3 +-- 14 files changed, 44 insertions(+), 41 deletions(-) diff --git a/zulip/examples/create-user b/zulip/examples/create-user index 8f4724b..67b72c0 100755 --- a/zulip/examples/create-user +++ b/zulip/examples/create-user @@ -29,7 +29,9 @@ usage = """create-user --new-email= --new-password= --n Create a user. You must be a realm admin to use this API, and the user will be created in your realm. -Example: create-user --site=http://localhost:9991 --user=rwbarton@example.com --new-email=jarthur@example.com --new-password=random17 --new-full-name 'J. Arthur Random' --new-short-name='jarthur' +Example: create-user --new-email=jarthur@example.com --new-password=random17 --new-full-name 'J. Arthur Random' --new-short-name='jarthur' + +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/edit-message b/zulip/examples/edit-message index 0776e91..85b8ffa 100755 --- a/zulip/examples/edit-message +++ b/zulip/examples/edit-message @@ -24,13 +24,13 @@ from __future__ import print_function import argparse -usage = """edit-message [options] --message= --subject= --content= --user= --api-key= +usage = """edit-message [options] --message= --subject= --content= Edits a message that you sent -Example: edit-message --message-id="348135" --subject="my subject" --content="test message" --user=othello-bot@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: edit-message --message-id="348135" --subject="my subject" --content="test message" -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/get-public-streams b/zulip/examples/get-public-streams index b28b24c..bde465e 100755 --- a/zulip/examples/get-public-streams +++ b/zulip/examples/get-public-streams @@ -24,13 +24,13 @@ from __future__ import print_function import argparse -usage = """get-public-streams --user= --api-key= [options] +usage = """get-public-streams [options] Prints out all the public streams in the realm. -Example: get-public-streams --user=othello-bot@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: get-public-streams -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/list-members b/zulip/examples/list-members index 1dc9804..f485433 100755 --- a/zulip/examples/list-members +++ b/zulip/examples/list-members @@ -24,11 +24,13 @@ from __future__ import print_function import argparse -usage = """list-members --user= --api-key= [options] +usage = """list-members [options] List the names and e-mail addresses of the people in your realm. -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Example: list-members + +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/list-subscriptions b/zulip/examples/list-subscriptions index e46b41e..bf0d67b 100755 --- a/zulip/examples/list-subscriptions +++ b/zulip/examples/list-subscriptions @@ -24,13 +24,13 @@ from __future__ import print_function import argparse -usage = """list-subscriptions --user= --api-key= [options] +usage = """list-subscriptions [options] Prints out a list of the user's subscriptions. -Example: list-subscriptions --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: list-subscriptions -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/print-events b/zulip/examples/print-events index 1de7782..8bda4d2 100755 --- a/zulip/examples/print-events +++ b/zulip/examples/print-events @@ -26,13 +26,13 @@ import argparse from typing import Any, Dict -usage = """print-events --user= --api-key= [options] +usage = """print-events [options] Prints out certain events received by the indicated bot or user matching the filter below. -Example: print-events --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: print-events -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/print-messages b/zulip/examples/print-messages index 3cf24d5..f58a55e 100755 --- a/zulip/examples/print-messages +++ b/zulip/examples/print-messages @@ -26,13 +26,13 @@ import argparse from typing import Any, Dict -usage = """print-messages --user= --api-key= [options] +usage = """print-messages [options] Prints out each message received by the indicated bot or user. -Example: print-messages --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: print-messages -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/recent-messages b/zulip/examples/recent-messages index d854dc5..9525599 100755 --- a/zulip/examples/recent-messages +++ b/zulip/examples/recent-messages @@ -25,13 +25,13 @@ from __future__ import print_function import json import argparse -usage = """recent-messages [options] --count= --user= --api-key= +usage = """recent-messages [options] --count= -Prints out last count messages received by the indicated bot or user +Prints out last count messages received by the bot or user used for authentication. -Example: recent-messages --count=101 --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: recent-messages --count=101 -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/subscribe b/zulip/examples/subscribe index 15254a5..14da8a3 100755 --- a/zulip/examples/subscribe +++ b/zulip/examples/subscribe @@ -25,14 +25,14 @@ from __future__ import print_function import sys import argparse -usage = """subscribe --user= --api-key= [options] --streams= +usage = """subscribe [options] --streams= Ensures the user is subscribed to the listed streams. -Examples: subscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo - subscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' +Examples: subscribe --streams=foo + subscribe --streams='foo bar' -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/unsubscribe b/zulip/examples/unsubscribe index c128b26..3019578 100755 --- a/zulip/examples/unsubscribe +++ b/zulip/examples/unsubscribe @@ -25,14 +25,14 @@ from __future__ import print_function import sys import argparse -usage = """unsubscribe --user= --api-key= [options] --streams= +usage = """unsubscribe [options] --streams= Ensures the user is not subscribed to the listed streams. -Examples: unsubscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo - unsubscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' +Examples: unsubscribe --streams=foo + unsubscribe --streams='foo bar' -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ import zulip diff --git a/zulip/examples/upload-file b/zulip/examples/upload-file index a8024e5..8901d59 100755 --- a/zulip/examples/upload-file +++ b/zulip/examples/upload-file @@ -31,13 +31,13 @@ import zulip class StringIO(_StringIO): name = '' # https://github.com/python/typeshed/issues/598 -usage = """upload-file --user= --api-key= [options] +usage = """upload-file [options] Upload a file, and print the corresponding URI. -Example: upload-file --user=cordelia@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --file-path=cat.png +Example: upload-file --file-path=cat.png -You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. If no --file-path is specified, a placeholder text file will be used instead. """ diff --git a/zulip/integrations/google/google-calendar b/zulip/integrations/google/google-calendar index ca631fc..f8df057 100755 --- a/zulip/integrations/google/google-calendar +++ b/zulip/integrations/google/google-calendar @@ -42,12 +42,12 @@ sys.path.append(os.path.dirname(__file__)) parser = zulip.add_default_arguments(argparse.ArgumentParser(r""" -google-calendar \ - --user foo@zulip.com \ - --calendar calendarID@example.calendar.google.com +google-calendar --calendar calendarID@example.calendar.google.com This integration can be used to send yourself reminders, on Zulip, of Google Calendar Events. + Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. + Before running this integration make sure you run the get-google-credentials file to give Zulip access to certain aspects of your Google Account. diff --git a/zulip/integrations/irc/irc-mirror.py b/zulip/integrations/irc/irc-mirror.py index 364605a..dc05fb3 100755 --- a/zulip/integrations/irc/irc-mirror.py +++ b/zulip/integrations/irc/irc-mirror.py @@ -106,13 +106,13 @@ class IRCBot(irc.bot.SingleServerIRCBot): return self.dcc_connect(address, port) -usage = """./irc-mirror.py --server=IRC_SERVER --channel= --nick-prefix= [optional args] +usage = """./irc-mirror.py --irc-server=IRC_SERVER --channel= --nick-prefix= [optional args] Example: ./irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=username - --site=https://zulip.example.com --user=irc-bot@example.com - --api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + +Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. Note that "_zulip" will be automatically appended to the IRC nick provided diff --git a/zulip/zulip/send.py b/zulip/zulip/send.py index efa51a4..72e3999 100755 --- a/zulip/zulip/send.py +++ b/zulip/zulip/send.py @@ -60,8 +60,7 @@ def main(): Examples: zulip-send --stream denmark --subject castle -m "Something is rotten in the state of Denmark." zulip-send hamlet@example.com cordelia@example.com -m "Conscience doth make cowards of us all." - These examples assume you have a proper '~/.zuliprc'. You may also set your credentials with the - '--user' and '--api-key' arguments. + Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options. """ parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))