Skip to content

Instantly share code, notes, and snippets.

@gguuss
Created July 11, 2018 00:11
Show Gist options
  • Save gguuss/61cb9290fe57a7c49a93f2c149752577 to your computer and use it in GitHub Desktop.
Save gguuss/61cb9290fe57a7c49a93f2c149752577 to your computer and use it in GitHub Desktop.
def pubsub_callback(message):
messages.append(message.data)
message.ack()
app.logger.info(message.data)
@app.before_request
def before_first_request():
subscriber = pubsub_v1.SubscriberClient()
subscription_path = subscriber.subscription_path(PROJECT_ID, subscription_name)
#subscriber.subscribe_experimental(subscription_name, pubsub_callback)
app.logger.info(subscription_path)
app.logger.info(dir(app))
subscriber.subscribe(subscription_path, pubsub_callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment