1

I would receive twitter on GCP. I using python language. When running python code, I received this problem:
google.api_core.exceptions.NotFound: 404 Requested project not found or user does not have access to it (project=My First Project). Make sure to specify the unique project identifier and not the Google Cloud Console display name.

here the code

def receive_tweets(project, subscription_name):
subscriber = pubsub.SubscriberClient()
print("aaaaa")
subscription_path = subscriber.subscription_path(
    project, subscription_name)

def callback(message):
    print("aaa")
    print('Received message: {}'.format(message))
    collect_tweets(message.data)
    message.ack()

future = subscriber.subscribe(subscription_path, callback=callback)
print('Listening for messages on {}'.format(subscription_path))

try:
    future.result()  **---error this rows**
except Exception as e:
    print(
        'Listening for messages on {} threw an Exception: {}'.format(
            subscription_name, e))
    raise

while True:
    time.sleep(10)

0 Answers0