Rename ~/.humbugrc to ~/.zuliprc.

(imported from commit a0d53dd20097a56971874dc1d84c6f95267e84f2)
This commit is contained in:
Tim Abbott 2013-08-07 11:36:46 -04:00 committed by Tim Abbott
parent cba5fbe125
commit 9aaefde9b2
17 changed files with 22 additions and 19 deletions

View file

@ -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 The easiest way to use these API bindings is to base your tools off
of the example tools under examples/ in this distribution. 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 API bindings will automatically read it in. The format of the config
file is as follows: file is as follows:
@ -75,7 +75,7 @@ API directly from existing scripts.
humbug-send hamlet@example.com cordelia@example.com -m \ humbug-send hamlet@example.com cordelia@example.com -m \
"Conscience doth make cowards of us all." "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 \ humbug-send --user shakespeare-bot@example.com \
--api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \ --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \

View file

@ -59,7 +59,7 @@ def main(argv=None):
Examples: %prog --stream denmark --subject castle -m "Something is rotten in the state of Denmark." 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." %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. '--user' and '--api-key' arguments.
""" """

View file

@ -25,7 +25,7 @@ To use this script:
1. Create an RSS feed file containing 1 feed URL per line (default feed 1. Create an RSS feed file containing 1 feed URL per line (default feed
file location: ~/.cache/humbug-rss/rss-feeds) file location: ~/.cache/humbug-rss/rss-feeds)
2. Subscribe to the stream that will receive RSS updates (default stream: rss) 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: 4. Test the script by running it manually, like this:
/usr/local/share/humbug/demos/rss-bot /usr/local/share/humbug/demos/rss-bot

View file

@ -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 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__), '..')) sys.path.insert(0, path.join(path.dirname(__file__), '..'))

View file

@ -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 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__), '..')) sys.path.append(path.join(path.dirname(__file__), '..'))

View file

@ -29,7 +29,7 @@ usage = """list-members --user=<bot's email address> --api-key=<bot's api key> [
List the names and e-mail addresses of the people in your realm. 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__), '..')) sys.path.append(path.join(path.dirname(__file__), '..'))

View file

@ -31,7 +31,7 @@ Prints out a list of the user's subscriptions.
Example: list-subscriptions --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 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__), '..')) sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug import humbug

View file

@ -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 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__), '..')) sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug import humbug

View file

@ -31,7 +31,7 @@ Prints out the next message received by the user.
Example: print-next-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 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__), '..')) sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug import humbug

View file

@ -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 --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 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 = optparse.OptionParser(usage=usage)
parser.add_option('--subject', default="test") parser.add_option('--subject', default="test")

View file

@ -32,7 +32,7 @@ Ensures the user is subscribed to the listed streams.
Examples: subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo Examples: subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo
subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' 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__), '..')) sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug import humbug

View file

@ -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 Examples: unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo
unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' 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__), '..')) sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug import humbug

View file

@ -1,4 +1,4 @@
; Save this file as ~/.humbugrc ; Save this file as ~/.zuliprc
[api] [api]
key=<your bot's api key from the web interface> key=<your bot's api key from the web interface>
email=<your bot's email address> email=<your bot's email address>

View file

@ -55,7 +55,7 @@ def generate_option_group(parser):
help='Email address of the calling bot or user.') help='Email address of the calling bot or user.')
group.add_option('--config-file', group.add_option('--config-file',
action='store', 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', group.add_option('-v', '--verbose',
action='store_true', action='store_true',
help='Provide detailed output.') help='Provide detailed output.')
@ -72,7 +72,10 @@ class Client(object):
site=None, client="API: Python"): site=None, client="API: Python"):
if None in (api_key, email): if None in (api_key, email):
if config_file is None: 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): if not os.path.exists(config_file):
raise RuntimeError("api_key or email not specified and %s does not exist" raise RuntimeError("api_key or email not specified and %s does not exist"
% (config_file,)) % (config_file,))

View file

@ -9,7 +9,7 @@ parser = optparse.OptionParser()
parser.add_option('--output', default='') parser.add_option('--output', default='')
parser.add_option('--long-output', default='') parser.add_option('--long-output', default='')
parser.add_option('--stream', default='nagios') 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'): for opt in ('type', 'host', 'service', 'state'):
parser.add_option('--' + opt) parser.add_option('--' + opt)
(opts, args) = parser.parse_args() (opts, args) = parser.parse_args()

View file

@ -1,5 +1,5 @@
# Fill these values in with the appropriate values for your realm, and # 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] [api]
email = nagios-bot@example.com email = nagios-bot@example.com
key = 0123456789abcdef0123456789abcdef key = 0123456789abcdef0123456789abcdef

View file

@ -26,7 +26,7 @@ setup(name='humbug',
], ],
url='https://www.zulip.com/dist/api/', url='https://www.zulip.com/dist/api/',
packages=['humbug'], 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/get-public-streams", "examples/unsubscribe",
"examples/list-members", "examples/list-subscriptions", "examples/list-members", "examples/list-subscriptions",
"examples/print-messages"])] + \ "examples/print-messages"])] + \