diff --git a/README.md b/README.md index 9ce5078..f8086e1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ as we make any changes to them. The easiest way to use these API bindings is to base your tools off of the example tools under examples/ in this distribution. -If you place your API key in the config file `~/.humbugrc` the Python +If you place your API key in the config file `~/.zuliprc` the Python API bindings will automatically read it in. The format of the config file is as follows: @@ -75,7 +75,7 @@ API directly from existing scripts. humbug-send hamlet@example.com cordelia@example.com -m \ "Conscience doth make cowards of us all." -Alternatively, if you don't want to use your ~/.humbugrc file: +Alternatively, if you don't want to use your ~/.zuliprc file: humbug-send --user shakespeare-bot@example.com \ --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \ diff --git a/bin/humbug-send b/bin/humbug-send index 0b505a4..9e1f4c0 100755 --- a/bin/humbug-send +++ b/bin/humbug-send @@ -59,7 +59,7 @@ def main(argv=None): Examples: %prog --stream denmark --subject castle -m "Something is rotten in the state of Denmark." %prog hamlet@example.com cordelia@example.com -m "Conscience doth make cowards of us all." - These examples assume you have a proper '~/.humbugrc'. You may also set your credentials with the + These examples assume you have a proper '~/.zuliprc'. You may also set your credentials with the '--user' and '--api-key' arguments. """ diff --git a/demos/rss-bot b/demos/rss-bot index 89e1e81..b236e05 100755 --- a/demos/rss-bot +++ b/demos/rss-bot @@ -25,7 +25,7 @@ To use this script: 1. Create an RSS feed file containing 1 feed URL per line (default feed file location: ~/.cache/humbug-rss/rss-feeds) 2. Subscribe to the stream that will receive RSS updates (default stream: rss) -3. create a ~/.humbugrc, or specify user and api-key with command line arguments +3. create a ~/.zuliprc, or specify user and api-key with command line arguments 4. Test the script by running it manually, like this: /usr/local/share/humbug/demos/rss-bot diff --git a/examples/edit-message b/examples/edit-message index 405cf5f..dbeb583 100755 --- a/examples/edit-message +++ b/examples/edit-message @@ -31,7 +31,7 @@ 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 -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.insert(0, path.join(path.dirname(__file__), '..')) diff --git a/examples/get-public-streams b/examples/get-public-streams index 1b708e1..fa736f9 100755 --- a/examples/get-public-streams +++ b/examples/get-public-streams @@ -31,7 +31,7 @@ Prints out all the public streams in the realm. Example: get-public-streams --user=othello-bot@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.append(path.join(path.dirname(__file__), '..')) diff --git a/examples/list-members b/examples/list-members index c062d06..3cc2155 100755 --- a/examples/list-members +++ b/examples/list-members @@ -29,7 +29,7 @@ usage = """list-members --user= --api-key= [ 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 ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.append(path.join(path.dirname(__file__), '..')) diff --git a/examples/list-subscriptions b/examples/list-subscriptions index af36916..11c1b73 100755 --- a/examples/list-subscriptions +++ b/examples/list-subscriptions @@ -31,7 +31,7 @@ Prints out a list of the user's subscriptions. Example: list-subscriptions --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.append(path.join(path.dirname(__file__), '..')) import humbug diff --git a/examples/print-messages b/examples/print-messages index 88a9e87..50a6de5 100755 --- a/examples/print-messages +++ b/examples/print-messages @@ -31,7 +31,7 @@ Prints out each message received by the indicated bot or user. Example: print-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.append(path.join(path.dirname(__file__), '..')) import humbug diff --git a/examples/print-next-message b/examples/print-next-message index 8a8334c..5c15892 100755 --- a/examples/print-next-message +++ b/examples/print-next-message @@ -31,7 +31,7 @@ Prints out the next message received by the user. Example: print-next-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.append(path.join(path.dirname(__file__), '..')) import humbug diff --git a/examples/send-message b/examples/send-message index c6aa384..bc2bad2 100755 --- a/examples/send-message +++ b/examples/send-message @@ -34,7 +34,7 @@ Sends a test message to the specified recipients. Example: send-message --user=your-bot@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --type=stream commits --subject="my subject" --message="test message" Example: send-message --user=your-bot@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 user1@example.com user2@example.com -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ parser = optparse.OptionParser(usage=usage) parser.add_option('--subject', default="test") diff --git a/examples/subscribe b/examples/subscribe index b2f8791..9925481 100755 --- a/examples/subscribe +++ b/examples/subscribe @@ -32,7 +32,7 @@ Ensures the user is subscribed to the listed streams. Examples: subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.append(path.join(path.dirname(__file__), '..')) import humbug diff --git a/examples/unsubscribe b/examples/unsubscribe index 3a10c5f..3085952 100755 --- a/examples/unsubscribe +++ b/examples/unsubscribe @@ -32,7 +32,7 @@ Ensures the user is not subscribed to the listed streams. Examples: unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' -You can omit --user and --api-key arguments if you have a properly set up ~/.humbugrc +You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ sys.path.append(path.join(path.dirname(__file__), '..')) import humbug diff --git a/examples/humbugrc b/examples/zuliprc similarity index 73% rename from examples/humbugrc rename to examples/zuliprc index 45fb0a8..9ce4253 100644 --- a/examples/humbugrc +++ b/examples/zuliprc @@ -1,4 +1,4 @@ -; Save this file as ~/.humbugrc +; Save this file as ~/.zuliprc [api] key= email= diff --git a/humbug/__init__.py b/humbug/__init__.py index 5f095aa..9d7cb3e 100644 --- a/humbug/__init__.py +++ b/humbug/__init__.py @@ -55,7 +55,7 @@ def generate_option_group(parser): help='Email address of the calling bot or user.') group.add_option('--config-file', action='store', - help='Location of an ini file containing the\nabove information. (default ~/.humbugrc)') + help='Location of an ini file containing the\nabove information. (default ~/.zuliprc)') group.add_option('-v', '--verbose', action='store_true', help='Provide detailed output.') @@ -72,7 +72,10 @@ class Client(object): site=None, client="API: Python"): if None in (api_key, email): if config_file is None: - config_file = os.path.join(os.environ["HOME"], ".humbugrc") + config_file = os.path.join(os.environ["HOME"], ".zuliprc") + if (not os.path.exists(config_file) and + os.path.exists(os.path.join(os.environ["HOME"], ".humbugrc"))): + raise RuntimeError("The Zulip API configuration file is now ~/.zuliprc; please run:\n\n mv ~/.humbugrc ~/.zuliprc\n") if not os.path.exists(config_file): raise RuntimeError("api_key or email not specified and %s does not exist" % (config_file,)) diff --git a/integrations/nagios/nagios-notify-humbug b/integrations/nagios/nagios-notify-humbug index 059399d..56fe91d 100755 --- a/integrations/nagios/nagios-notify-humbug +++ b/integrations/nagios/nagios-notify-humbug @@ -9,7 +9,7 @@ parser = optparse.OptionParser() parser.add_option('--output', default='') parser.add_option('--long-output', default='') parser.add_option('--stream', default='nagios') -parser.add_option('--config', default='/etc/nagios3/humbugrc') +parser.add_option('--config', default='/etc/nagios3/zuliprc') for opt in ('type', 'host', 'service', 'state'): parser.add_option('--' + opt) (opts, args) = parser.parse_args() diff --git a/integrations/nagios/humbugrc.example b/integrations/nagios/zuliprc.example similarity index 74% rename from integrations/nagios/humbugrc.example rename to integrations/nagios/zuliprc.example index cb7cc97..6fb0a6b 100644 --- a/integrations/nagios/humbugrc.example +++ b/integrations/nagios/zuliprc.example @@ -1,5 +1,5 @@ # Fill these values in with the appropriate values for your realm, and -# then install this value at /etc/nagios3/humbugrc +# then install this value at /etc/nagios3/zuliprc [api] email = nagios-bot@example.com key = 0123456789abcdef0123456789abcdef diff --git a/setup.py b/setup.py index 61d7970..a0db66c 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ setup(name='humbug', ], url='https://www.zulip.com/dist/api/', packages=['humbug'], - data_files=[('share/humbug/examples', ["examples/humbugrc", "examples/send-message", "examples/subscribe", + data_files=[('share/humbug/examples', ["examples/zuliprc", "examples/send-message", "examples/subscribe", "examples/get-public-streams", "examples/unsubscribe", "examples/list-members", "examples/list-subscriptions", "examples/print-messages"])] + \