GoogleCloudPlatform / training-data-analyst

Labs and demos for courses for GCP Training (http://cloud.google.com/training).
Apache License 2.0
7.9k stars 5.87k forks source link

PublisherClient courses/streaming/publish/send_sensor_data.py Error #466

Open crispindev opened 5 years ago

crispindev commented 5 years ago

Hi Team,

I keep getting a PublicherClient() Error when trying to run the python send_sensor_data.py script.

I tried the virtualenv set up and it did not run. Have not tried to downgrade the PubSub version but if this is being used for all demos it would be great to have it up to date! best Cris

crispindev commented 5 years ago

Just changing the send_sensor_data.py script to from google.cloud import pubsub_v1

Line 89: publisher = pubsub_v1.PublisherClient()

Fixes the error.

vicfullstack commented 4 years ago

Also publisher.get_topic(event_type) should be replaced by publisher.get_topic(topic=event_type)