@click.command()
def broadcast():
    if None in ('TWITTER_CONSUMER_KEY',
                TWITTER_CONSUMER_SECRET,
                TWITTER_ACCESS_TOKEN,
                TWITTER_ACCESS_SECRET):
        logging.error('Unable to broadcast, missing twitter settings')
        exit(1)

    if BROADCAST_INTERNAL_URL is None or BROADCAST_PUSH_TOKEN is None:
        logging.error('Unable to broadcast, missing broadcast settings')
        exit(1)

    stream = TwitterStream(consumer_key=TWITTER_CONSUMER_KEY,
                           consumer_secret=TWITTER_CONSUMER_SECRET,
                           access_token=TWITTER_ACCESS_TOKEN,
                           access_secret=TWITTER_ACCESS_SECRET,
                           broadcast=True,
                           broadcast_internal_url=BROADCAST_INTERNAL_URL,
                           broadcast_push_token=BROADCAST_PUSH_TOKEN)

    return stream.listen()
Listen on and broadcast the Twitter stream.
dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/cli/commands/cmd_stream.py/broadcast