Example #1
0
                                       username=discovery_username,
                                       password=discovery_password)

        # Instantiate Slack chatbot.
        if 'placeholder' in slack_bot_token:
            raise Exception("SLACK_BOT_TOKEN needs to be set correctly. "
                            "It is currently set to 'placeholder'.")
        slack_client = SlackClient(slack_bot_token)
        # If BOT_ID wasn't set, we can get it using SlackClient and user ID.
        if not bot_id:
            bot_id = WatsonEnv.get_slack_user_id(slack_client)
            if not bot_id:
                print("Error: Missing BOT_ID or invalid SLACK_BOT_USER.")
                return None

        # Start Watson Online Store app.
        watsononlinestore = WatsonOnlineStore(bot_id, slack_client,
                                              conversation_client,
                                              discovery_client,
                                              cloudant_online_store)
        return watsononlinestore


if __name__ == "__main__":
    cf_deployment_tracker.track()
    metrics_tracker_client.track()

    watsononlinestore = WatsonEnv.get_watson_online_store()

    watsononlinestore.run()
from flask import Flask
import os
import metrics_tracker_client

app = Flask(__name__)
metrics_tracker_client.track()  # Trackingするなら必要


@app.route('/')
def index():
    return '<h1>Hello World!</h1>'


port = os.getenv('PORT', '5000')  # portはIBM Cloud環境から割り当てられたものを利用

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=int(port),
            debug=True)  # Procfile内でpython hello.pyで起動