mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
Rename the 'humbug' API module to 'zulip'.
(imported from commit b3a3d7c05459cbb0110cd0fbe2197d779f3a6264)
This commit is contained in:
@@ -42,8 +42,8 @@ A typical simple bot sending API messages will look as follows:
|
||||
At the top of the file:
|
||||
|
||||
# Make sure the Zulip API distribution's root directory is in sys.path, then:
|
||||
import humbug
|
||||
humbug_client = humbug.Client(email="your-bot@example.com")
|
||||
import zulip
|
||||
zulip_client = zulip.Client(email="your-bot@example.com")
|
||||
|
||||
When you want to send a message:
|
||||
|
||||
@@ -53,7 +53,7 @@ When you want to send a message:
|
||||
"subject": "your subject",
|
||||
"content": "your content",
|
||||
}
|
||||
humbug_client.send_message(message)
|
||||
zulip_client.send_message(message)
|
||||
|
||||
Additional examples:
|
||||
|
||||
|
||||
@@ -65,12 +65,12 @@ def main(argv=None):
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
||||
# Grab parser options from the API common set
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
|
||||
parser.add_option('-m', '--message',
|
||||
help='Specifies the message to send, prevents interactive prompting.')
|
||||
@@ -99,7 +99,7 @@ def main(argv=None):
|
||||
if len(recipients) == 0 and not (options.stream and options.subject):
|
||||
parser.error('You must specify a stream/subject or at least one recipient.')
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
if not options.message:
|
||||
options.message = sys.stdin.read()
|
||||
|
||||
@@ -11,7 +11,7 @@ import time
|
||||
import urlparse
|
||||
|
||||
import feedparser
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
RSS_DATA_DIR = os.path.expanduser(os.path.join('~', '.cache', 'humbug-rss'))
|
||||
OLDNESS_THRESHOLD = 30 # days
|
||||
@@ -56,7 +56,7 @@ parser.add_option('--feed-file',
|
||||
help='The file containing a list of RSS feed URLs to follow, one URL per line',
|
||||
default=os.path.join(RSS_DATA_DIR, "rss-feeds"),
|
||||
action='store')
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
def mkdir_p(path):
|
||||
@@ -131,7 +131,7 @@ try:
|
||||
except IOError:
|
||||
log_error_and_exit("Unable to read feed file at %s." % (opts.feed_file,))
|
||||
|
||||
client = humbug.Client(email=opts.email, api_key=opts.api_key,
|
||||
client = zulip.Client(email=opts.email, api_key=opts.api_key,
|
||||
site=opts.site)
|
||||
|
||||
first_message = True
|
||||
|
||||
@@ -4,7 +4,7 @@ import sys
|
||||
import optparse
|
||||
import ConfigParser
|
||||
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
CONFIGFILE = os.path.expanduser("~/.humbug_twitterrc")
|
||||
|
||||
@@ -54,7 +54,7 @@ parser.add_option('--limit-tweets',
|
||||
type='int',
|
||||
help='Maximum number of tweets to push at once')
|
||||
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if not options.twitter_id:
|
||||
@@ -101,7 +101,7 @@ try:
|
||||
except ConfigParser.NoOptionError:
|
||||
user_id = options.twitter_id
|
||||
|
||||
client = humbug.Client(
|
||||
client = zulip.Client(
|
||||
email=options.user,
|
||||
api_key=options.api_key,
|
||||
site=options.site,
|
||||
|
||||
@@ -4,7 +4,7 @@ import sys
|
||||
import optparse
|
||||
import ConfigParser
|
||||
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
CONFIGFILE = os.path.expanduser("~/.humbug_twitterrc")
|
||||
|
||||
@@ -76,7 +76,7 @@ parser.add_option('--limit-tweets',
|
||||
type='int',
|
||||
help='Maximum number of tweets to send at once')
|
||||
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
if not opts.search_terms:
|
||||
@@ -118,7 +118,7 @@ if not user.GetId():
|
||||
Please double-check and try again."
|
||||
sys.exit()
|
||||
|
||||
client = humbug.Client(
|
||||
client = zulip.Client(
|
||||
email=opts.user,
|
||||
api_key=opts.api_key,
|
||||
site=opts.site,
|
||||
|
||||
@@ -35,16 +35,16 @@ You can omit --user and --api-key arguments if you have a properly set up ~/.zul
|
||||
"""
|
||||
|
||||
sys.path.insert(0, path.join(path.dirname(__file__), '..'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option('--message-id', default="")
|
||||
parser.add_option('--subject', default="")
|
||||
parser.add_option('--content', default="")
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
message_data = {
|
||||
"message_id": options.message_id,
|
||||
|
||||
@@ -35,12 +35,12 @@ You can omit --user and --api-key arguments if you have a properly set up ~/.zul
|
||||
"""
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
print client.get_public_streams()
|
||||
|
||||
@@ -33,13 +33,13 @@ You can omit --user and --api-key arguments if you have a properly set up ~/.zul
|
||||
"""
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
for user in client.get_members()["members"]:
|
||||
print user["full_name"], user["email"]
|
||||
|
||||
@@ -34,12 +34,12 @@ Example: list-subscriptions --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c
|
||||
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
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
print client.list_subscriptions()
|
||||
|
||||
@@ -34,13 +34,13 @@ Example: print-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e
|
||||
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
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
def print_message(message):
|
||||
print message
|
||||
|
||||
@@ -34,12 +34,12 @@ Example: print-next-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7
|
||||
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
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
print client.get_messages({})
|
||||
|
||||
@@ -25,7 +25,7 @@ import sys
|
||||
from os import path
|
||||
import optparse
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
usage = """send-message --user=<bot's email address> --api-key=<bot's api key> [options] <recipients>
|
||||
|
||||
@@ -40,13 +40,13 @@ parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option('--subject', default="test")
|
||||
parser.add_option('--message', default="test message")
|
||||
parser.add_option('--type', default='private')
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if len(args) == 0:
|
||||
parser.error("You must specify recipients")
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
message_data = {
|
||||
"type": options.type,
|
||||
|
||||
@@ -35,14 +35,14 @@ Examples: subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a
|
||||
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
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
parser.add_option('--streams', default='')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
if options.streams == "":
|
||||
print >>sys.stderr, "Usage:", parser.usage
|
||||
|
||||
@@ -35,14 +35,14 @@ Examples: unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f
|
||||
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
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
parser.add_option('--streams', default='')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
if options.streams == "":
|
||||
print >>sys.stderr, "Usage:", parser.usage
|
||||
|
||||
@@ -40,8 +40,8 @@ import humbug_git_config as config
|
||||
if config.HUMBUG_API_PATH is not None:
|
||||
sys.path.append(config.HUMBUG_API_PATH)
|
||||
|
||||
import humbug
|
||||
client = humbug.Client(
|
||||
import zulip
|
||||
client = zulip.Client(
|
||||
email=config.HUMBUG_USER,
|
||||
site=config.HUMBUG_SITE,
|
||||
api_key=config.HUMBUG_API_KEY)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
import optparse
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
# Nagios passes the notification details as command line options.
|
||||
# In Nagios, "output" means "first line of output", and "long
|
||||
@@ -14,7 +14,7 @@ for opt in ('type', 'host', 'service', 'state'):
|
||||
parser.add_option('--' + opt)
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
client = humbug.Client(config_file=opts.config)
|
||||
client = zulip.Client(config_file=opts.config)
|
||||
|
||||
msg = dict(type='stream', to=opts.stream)
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ import humbug_svn_config as config
|
||||
if config.HUMBUG_API_PATH is not None:
|
||||
sys.path.append(config.HUMBUG_API_PATH)
|
||||
|
||||
import humbug
|
||||
client = humbug.Client(
|
||||
import zulip
|
||||
client = zulip.Client(
|
||||
email=config.HUMBUG_USER,
|
||||
site=config.HUMBUG_SITE,
|
||||
api_key=config.HUMBUG_API_KEY)
|
||||
|
||||
@@ -44,8 +44,8 @@ import humbug_trac_config as config
|
||||
if config.HUMBUG_API_PATH is not None:
|
||||
sys.path.append(config.HUMBUG_API_PATH)
|
||||
|
||||
import humbug
|
||||
client = humbug.Client(
|
||||
import zulip
|
||||
client = zulip.Client(
|
||||
email=config.HUMBUG_USER,
|
||||
site=config.HUMBUG_SITE,
|
||||
api_key=config.HUMBUG_API_KEY)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
import os
|
||||
from distutils.core import setup
|
||||
@@ -12,8 +12,8 @@ def recur_expand(target_root, dir):
|
||||
if len(paths):
|
||||
yield os.path.join(target_root, root), paths
|
||||
|
||||
setup(name='humbug',
|
||||
version=humbug.__version__,
|
||||
setup(name='zulip',
|
||||
version=zulip.__version__,
|
||||
description='Bindings for the Zulip message API',
|
||||
author='Zulip, Inc.',
|
||||
author_email='humbug@humbughq.com',
|
||||
@@ -25,7 +25,7 @@ setup(name='humbug',
|
||||
'Topic :: Communications :: Chat',
|
||||
],
|
||||
url='https://www.zulip.com/dist/api/',
|
||||
packages=['humbug'],
|
||||
packages=['zulip'],
|
||||
data_files=[('share/humbug/examples', ["examples/zuliprc", "examples/send-message", "examples/subscribe",
|
||||
"examples/get-public-streams", "examples/unsubscribe",
|
||||
"examples/list-members", "examples/list-subscriptions",
|
||||
|
||||
@@ -26,7 +26,7 @@ parser.add_option('--root-path',
|
||||
action='store')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# The 'api' directory needs to go first, so that 'import humbug' won't pick up
|
||||
# The 'api' directory needs to go first, so that 'import zulip' won't pick up
|
||||
# some other directory named 'humbug'.
|
||||
sys.path[:0] = [os.path.join(options.root_path, "api/"),
|
||||
os.path.join(options.root_path, "python-zephyr"),
|
||||
@@ -37,8 +37,8 @@ mit_user = 'tabbott/extra@ATHENA.MIT.EDU'
|
||||
humbug_user = 'tabbott/extra@mit.edu'
|
||||
|
||||
sys.path.append(".")
|
||||
import humbug
|
||||
humbug_client = humbug.Client(
|
||||
import zulip
|
||||
zulip_client = zulip.Client(
|
||||
email=humbug_user,
|
||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
verbose=True,
|
||||
@@ -103,7 +103,7 @@ def print_status_and_exit(status):
|
||||
sys.exit(status)
|
||||
|
||||
def send_humbug(message):
|
||||
result = humbug_client.send_message(message)
|
||||
result = zulip_client.send_message(message)
|
||||
if result["result"] != "success":
|
||||
logger.error("Error sending zulip, args were:")
|
||||
logger.error(message)
|
||||
@@ -128,7 +128,7 @@ def send_zephyr(zwrite_args, content):
|
||||
|
||||
# Subscribe to Zulip
|
||||
try:
|
||||
res = humbug_client.get_profile()
|
||||
res = zulip_client.get_profile()
|
||||
max_message_id = res.get('max_message_id')
|
||||
if max_message_id is None:
|
||||
logging.error("Error subscribing to Zulips!")
|
||||
@@ -264,7 +264,7 @@ receive_zephyrs()
|
||||
logger.info("Starting receiving messages!")
|
||||
|
||||
# receive zulips
|
||||
messages = humbug_client.get_messages({'last': str(max_message_id)})['messages']
|
||||
messages = zulip_client.get_messages({'last': str(max_message_id)})['messages']
|
||||
logger.info("Finished receiving Zulip messages!")
|
||||
|
||||
receive_zephyrs()
|
||||
|
||||
@@ -4,7 +4,7 @@ from os import path
|
||||
import logging
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '../api'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
class StreamLogger(object):
|
||||
"""
|
||||
@@ -32,12 +32,12 @@ sys.stdout = stdout_logger
|
||||
stderr_logger = StreamLogger(logging.getLogger("stderr"), logging.ERROR)
|
||||
sys.stderr = stderr_logger
|
||||
|
||||
prod_client = humbug.Client(
|
||||
prod_client = zulip.Client(
|
||||
email="feedback@zulip.com",
|
||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
verbose=True,
|
||||
site="https://api.zulip.com")
|
||||
staging_client = humbug.Client(
|
||||
staging_client = zulip.Client(
|
||||
email="feedback@zulip.com",
|
||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
verbose=True,
|
||||
|
||||
@@ -9,7 +9,7 @@ import traceback
|
||||
from os import path
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '../api'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(r"""
|
||||
|
||||
@@ -43,7 +43,7 @@ parser.add_option('--interval',
|
||||
action='store',
|
||||
help='Minutes before event for reminder [default: 10]',
|
||||
metavar='MINUTES')
|
||||
parser.add_option_group(humbug.generate_option_group(parser))
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@@ -66,7 +66,7 @@ def get_calendar_url():
|
||||
|
||||
calendar_url = get_calendar_url()
|
||||
|
||||
client = humbug.init_from_options(options)
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
def get_events():
|
||||
feed = CalendarClient().GetCalendarEventFeed(uri=calendar_url)
|
||||
|
||||
@@ -8,15 +8,15 @@ import subprocess
|
||||
import unicodedata
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..', 'api'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
humbug_client = humbug.Client()
|
||||
zulip_client = zulip.Client()
|
||||
|
||||
def fetch_public_streams():
|
||||
public_streams = set()
|
||||
|
||||
try:
|
||||
res = humbug_client.get_public_streams()
|
||||
res = zulip_client.get_public_streams()
|
||||
if res.get("result") == "success":
|
||||
streams = res["streams"]
|
||||
else:
|
||||
|
||||
@@ -46,9 +46,9 @@ humbug_directory = path.join(path.dirname(__file__), '../api')
|
||||
|
||||
|
||||
sys.path.append(humbug_directory)
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
client = humbug.Client(
|
||||
client = zulip.Client(
|
||||
email = environ['HUMBUG_USER'],
|
||||
api_key = environ.get('HUMBUG_API_KEY'))
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ def send_zulip(zeph):
|
||||
logger.debug("Message is: %s" % (str(message),))
|
||||
return {'result': "success"}
|
||||
|
||||
return humbug_client.send_message(message)
|
||||
return zulip_client.send_message(message)
|
||||
|
||||
def send_error_zulip(error_msg):
|
||||
message = {"type": "private",
|
||||
@@ -173,7 +173,7 @@ def send_error_zulip(error_msg):
|
||||
"to": zulip_account_email,
|
||||
"content": error_msg,
|
||||
}
|
||||
humbug_client.send_message(message)
|
||||
zulip_client.send_message(message)
|
||||
|
||||
current_zephyr_subs = set()
|
||||
def zephyr_bulk_subscribe(subs):
|
||||
@@ -623,7 +623,7 @@ def zulip_to_zephyr(options):
|
||||
logger.info("Starting syncing messages.")
|
||||
while True:
|
||||
try:
|
||||
humbug_client.call_on_each_message(maybe_forward_to_zephyr)
|
||||
zulip_client.call_on_each_message(maybe_forward_to_zephyr)
|
||||
except Exception:
|
||||
logger.exception("Error syncing messages:")
|
||||
time.sleep(1)
|
||||
@@ -675,7 +675,7 @@ def add_zulip_subscriptions(verbose):
|
||||
zephyr_subscriptions.add(cls)
|
||||
|
||||
if len(zephyr_subscriptions) != 0:
|
||||
res = humbug_client.add_subscriptions(list({"name": stream} for stream in zephyr_subscriptions))
|
||||
res = zulip_client.add_subscriptions(list({"name": stream} for stream in zephyr_subscriptions))
|
||||
if res.get("result") != "success":
|
||||
logger.error("Error subscribing to streams:\n%s" % (res["msg"],))
|
||||
return
|
||||
@@ -866,7 +866,7 @@ if __name__ == "__main__":
|
||||
logger = open_logger()
|
||||
configure_logger(logger, "parent")
|
||||
|
||||
# The 'api' directory needs to go first, so that 'import humbug' won't pick
|
||||
# The 'api' directory needs to go first, so that 'import zulip' won't pick
|
||||
# up some other directory named 'humbug'.
|
||||
pyzephyr_lib_path = "python-zephyr/build/lib.linux-" + os.uname()[4] + "-2.6/"
|
||||
sys.path[:0] = [os.path.join(options.root_path, 'api'),
|
||||
@@ -892,8 +892,8 @@ or specify the --api-key-file option.""" % (options.api_key_file,))))
|
||||
os.environ["HUMBUG_API_KEY"] = api_key
|
||||
|
||||
zulip_account_email = options.user + "@mit.edu"
|
||||
import humbug
|
||||
humbug_client = humbug.Client(
|
||||
import zulip
|
||||
zulip_client = zulip.Client(
|
||||
email=zulip_account_email,
|
||||
api_key=api_key,
|
||||
verbose=True,
|
||||
|
||||
@@ -59,7 +59,7 @@ sendreceive.critical 5"""
|
||||
sys.exit(0)
|
||||
|
||||
sys.path.append('/home/humbug/humbug-deployments/current/api')
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
states = {
|
||||
"OK": 0,
|
||||
@@ -101,14 +101,14 @@ else:
|
||||
recipient_key = "24cf18de98d5c31da9c6c79f0cbec195"
|
||||
site = "https://api.zulip.com"
|
||||
|
||||
humbug_sender = humbug.Client(
|
||||
humbug_sender = zulip.Client(
|
||||
email=sender,
|
||||
api_key=sender_key,
|
||||
verbose=True,
|
||||
client="test: Humbug API",
|
||||
site=site)
|
||||
|
||||
humbug_recipient = humbug.Client(
|
||||
humbug_recipient = zulip.Client(
|
||||
email=recipient,
|
||||
api_key=recipient_key,
|
||||
verbose=True,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<p><strong>Don't want to make it yourself?</strong> Zulip <a href="/integrations">already integrates with lots of services</a>.</p>
|
||||
|
||||
<br/>
|
||||
<a href="https://zulip.com/dist/api/python-humbug_0.1.9.tar.gz" class="btn btn-large btn-primary btn-block"><i class="icon-vector-download"></i> Download Python bindings and examples</a>
|
||||
<a href="https://zulip.com/dist/api/python-zulip_0.1.9.tar.gz" class="btn btn-large btn-primary btn-block"><i class="icon-vector-download"></i> Download Python bindings and examples</a>
|
||||
<span class="pull-right muted">Version 0.1.9</span>
|
||||
|
||||
<p> </p>
|
||||
@@ -66,11 +66,11 @@ to pull out the resulting HTML :)
|
||||
<div class="tab-pane" id="python">
|
||||
<div class="codehilite"><pre><span class="c">#!/usr/bin/env python</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">humbug</span>
|
||||
<span class="kn">import</span> <span class="nn">zulip</span>
|
||||
<span class="kn">import</span> <span class="nn">sys</span>
|
||||
|
||||
<span class="c"># Keyword arguments 'email' and 'api_key' are optional if you are using ~/.zuliprc</span>
|
||||
<span class="n">client</span> <span class="o">=</span> <span class="n">humbug</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="p">email</span><span class="o">=</span><span class="s">"othello-bot@example.com"</span><span class="p">,</span>
|
||||
<span class="n">client</span> <span class="o">=</span> <span class="n">zulip</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="p">email</span><span class="o">=</span><span class="s">"othello-bot@example.com"</span><span class="p">,</span>
|
||||
<span class="n">api_key</span><span class="o">=</span><span class="s">"a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">stream_message</span> <span class="o">=</span> <span class="p">{</span>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
cd api/
|
||||
# Strip out non-send_message bindings.
|
||||
perl -i.bak -ne 'print if !m/Client._register/ ||m/send_message/ ||m/get_messages/ ||m/add_subscriptions/ ||m/list_subscriptions/ ||m/remove_subscriptions/ ||m/get_public_streams/ ||m/get_members/ ||m/_register.*register/ ||m/get_events/' humbug/__init__.py
|
||||
perl -i.bak -ne 'print if !m/Client._register/ ||m/send_message/ ||m/get_messages/ ||m/add_subscriptions/ ||m/list_subscriptions/ ||m/remove_subscriptions/ ||m/get_public_streams/ ||m/get_members/ ||m/_register.*register/ ||m/get_events/' zulip/__init__.py
|
||||
python setup.py sdist
|
||||
mv humbug/__init__.py.bak humbug/__init__.py
|
||||
mv zulip/__init__.py.bak zulip/__init__.py
|
||||
echo API tarball written to api/dist
|
||||
|
||||
@@ -17,7 +17,7 @@ parser.add_option("--site",
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '../../api'))
|
||||
import humbug
|
||||
import zulip
|
||||
|
||||
characters = {'othello': {'api-key': '4e5d97591bec64bf57d2698ffbb563e3', 'intro': ''},
|
||||
'iago': {'api-key': 'd43b53c27a8106195b46781abc67901a', 'intro': ''}}
|
||||
@@ -35,7 +35,7 @@ next_user = gen_next_user()
|
||||
|
||||
def connect_all(users):
|
||||
for user in users:
|
||||
users[user]['client'] = humbug.Client(
|
||||
users[user]['client'] = zulip.Client(
|
||||
email=user + '@zulip.com',
|
||||
api_key=users[user]['api-key'],
|
||||
site=options.site,
|
||||
|
||||
@@ -438,8 +438,8 @@ def main(args):
|
||||
print >>sys.stdout, msg.get_payload(decode=True),
|
||||
else:
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../api'))
|
||||
import humbug
|
||||
client = humbug.Client(verbose=True)
|
||||
import zulip
|
||||
client = zulip.Client(verbose=True)
|
||||
|
||||
reviewer_usernames = [x.split("@")[0] for x in opts.reviewers]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user