Rename ~/.humbugrc to ~/.zuliprc.
(imported from commit a0d53dd20097a56971874dc1d84c6f95267e84f2)
This commit is contained in:
parent
cba5fbe125
commit
9aaefde9b2
|
@ -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 \
|
||||
|
|
|
@ -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.
|
||||
"""
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__), '..'))
|
||||
|
|
|
@ -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__), '..'))
|
||||
|
|
|
@ -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.
|
||||
|
||||
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__), '..'))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; Save this file as ~/.humbugrc
|
||||
; Save this file as ~/.zuliprc
|
||||
[api]
|
||||
key=<your bot's api key from the web interface>
|
||||
email=<your bot's email address>
|
|
@ -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,))
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
2
setup.py
2
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"])] + \
|
||||
|
|
Loading…
Reference in a new issue