'subscriber does not listen to my gmail emails
I'm struggling with the pub/sub api. I have followed this guide. I have created my project, my topic, set up with [email protected] to be the publisher, and my subscription.
And finally, that's my code
import os
from google.cloud import pubsub_v1
from concurrent.futures import TimeoutError
credentials_path = os.getcwd() + '/credentials.json'
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = credentials_path
timeout = 5.0
subscriber = pubsub_v1.SubscriberClient()
subscription_path = 'MY_SUBSCRIPTION_PATH'
def callback(message):
print(f'Received message: {message}')
print(f'data: {message.data}')
if message.attributes:
print("Attributes:")
for key in message.attributes:
value = message.attributes.get(key)
print(f"{key}: {value}")
message.ack()
streaming_pull_future = subscriber.subscribe(subscription_path, callback=callback)
print(f'Listening for messages on {subscription_path}')
with subscriber:
try:
streaming_pull_future.result()
except (TimeoutError, KeyboardInterrupt):
streaming_pull_future.cancel()
streaming_pull_future.result()
Because the GH code of gmail's pub/sub didn't work, I got this one from a guide, thus I had to create a service account. Everything seems to work fine, in fact, if I publish a message on the pub/sub api the subscriber is able to catch it.

But if I send a message to myself to my gmail, it's not able to see it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

