Bots: Send messages through staging.humbughq.com.

(imported from commit d9859bfe5f5b3b7c5efa5ef930d6cfaa5c0d1fc2)
This commit is contained in:
Tim Abbott 2012-11-06 14:29:40 -05:00
parent 58684965da
commit 9b8e5bc93f
3 changed files with 12 additions and 19 deletions

View File

@ -3,25 +3,16 @@ import sys
import os
import optparse
usage = """feedback-bot [options]
Forwards messages from MIT realm users sent to feedback@humbughq.com over to Humbug realm
Example: feedback-bot --site=http://127.0.0.1:9991
"""
parser = optparse.OptionParser(usage=usage)
parser.add_option('--site',
dest='site',
default="https://humbughq.com",
action='store')
(options, args) = parser.parse_args()
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import api.common
client = api.common.HumbugAPI(email="feedback@humbughq.com",
prod_client = api.common.HumbugAPI(email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site=options.site)
site="https://humbughq.com")
staging_client = api.common.HumbugAPI(email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://staging.humbughq.com")
def forward_message(message):
forwarded_message = {
@ -30,6 +21,6 @@ def forward_message(message):
"subject": "feedback from %s" % message["sender_email"],
"content": message["content"],
}
client.send_message(forwarded_message)
staging_client.send_message(forwarded_message)
client.call_on_each_message(forward_message)
prod_client.call_on_each_message(forward_message)

View File

@ -21,6 +21,7 @@ import sys
sys.path.append("/home/humbug/humbug")
import api.common
client = api.common.HumbugAPI(email="humbug+trac@humbughq.com",
site="https://staging.humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
def markdown_ticket_url(ticket, heading="ticket"):

View File

@ -306,6 +306,7 @@ def main(args):
print >>sys.stderr, "You need to place your Humbug API key at %s" % (api_key_file,)
sys.exit(1)
client = api.common.HumbugAPI(email=me[me.index("<") + 1:me.index('>')],
site="https://staging.humbughq.com",
api_key=file(api_key_file).read().strip(),
verbose=True)
client.send_message({'type': "personal",