2012-10-01 15:36:44 -04:00
|
|
|
#!/usr/bin/python
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import optparse
|
|
|
|
|
2012-10-18 16:36:21 -04:00
|
|
|
usage = """print-messages --user=<email address> [options]
|
2012-10-01 15:36:44 -04:00
|
|
|
|
|
|
|
Prints out each message received by the indicated user.
|
|
|
|
|
|
|
|
Example: print-messages --user=tabbott@humbughq.com --site=http://127.0.0.1:8000
|
|
|
|
"""
|
|
|
|
parser = optparse.OptionParser(usage=usage)
|
|
|
|
parser.add_option('--site',
|
|
|
|
dest='site',
|
2012-10-02 15:47:59 -04:00
|
|
|
default="https://app.humbughq.com",
|
2012-10-01 15:36:44 -04:00
|
|
|
action='store')
|
|
|
|
parser.add_option('--api-key',
|
|
|
|
dest='api_key',
|
|
|
|
default="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
action='store')
|
|
|
|
parser.add_option('--user',
|
|
|
|
dest='user',
|
|
|
|
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=options.user,
|
|
|
|
api_key=options.api_key,
|
|
|
|
verbose=True,
|
|
|
|
site=options.site)
|
|
|
|
|
|
|
|
def print_message(message):
|
|
|
|
print message
|
|
|
|
|
|
|
|
client.call_on_each_message(print_message)
|