@click.command()
def fake_broadcast():
    fake = Faker()

    while True:
        random_types = ('tweet', 'retweet', 'favorite')
        random_tweet = fake.text(max_nb_chars=140)

        data = {
            'created_at': str(datetime.datetime.now(pytz.utc)),
            'type': random.choice(random_types),
            'tweet': random_tweet,
            'user': fake.user_name()
        }

        faye_protocol = {
            'channel': '/cats',
            'data': data,
            'ext': {
                'pushToken': BROADCAST_PUSH_TOKEN
            }
        }

        broadcast_message.delay(BROADCAST_INTERNAL_URL, faye_protocol)
        logging.info(data)
        sleep(1)

    return None
Broadcast fake events (useful for testing).
dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/cli/commands/cmd_stream.py/fake_broadcast