You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I modified the script in my local machine to include Service Account and that is the only change. publisher = pubsub_v1.PublisherClient.from_service_account_json("<json key>")
This is what I get when i execute:
python publisher.py siva-poc publish "projects/siva-poc/topics/sample_topic"
Traceback (most recent call last):
File "publisher.py", line 275, in
publish_messages(publisher,args.project_id, args.topic_name)
File "publisher.py", line 93, in publish_messages
future = publisher.publish(topic_path, data=data)
TypeError: publish() got an unexpected keyword argument 'data'
I tried a different operation "publish-with-custom-attributes" but it still complains:
python publisher.py siva-poc publish-with-custom-attributes "projects/siva-poc/topics/sample_topic"
Traceback (most recent call last):
File "publisher.py", line 278, in
args.project_id, args.topic_name)
File "publisher.py", line 125, in publish_messages_with_custom_attributes
topic_path, data, origin='python-sample', username='gcp')
TypeError: publish() got an unexpected keyword argument 'origin'
I am not sure why is it complaining about the argument in the publisher_client.
Could someone help me with this, please?
The text was updated successfully, but these errors were encountered:
I got some insights from a different post to fix this. There is an issue with the way we pass service account. pubsub_v1.PublisherClient.from_service_account_json("<json key>")
I tried a different approach and that worked. credentials = service_account.Credentials.from_service_account_file("<json key>") publisher = pubsub_v1.PublisherClient(credentials=credentials)
But I believe PublisherClient still needs to be fixed.
It appears it has been fixed by PR googleapis/google-cloud-python#6666 just 8 days ago. It should be available via pip install soon. Thanks for the report - it led to this fix!
I am trying to execute the file https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/pubsub/cloud-client/publisher.py
I modified the script in my local machine to include Service Account and that is the only change.
publisher = pubsub_v1.PublisherClient.from_service_account_json("<json key>")
This is what I get when i execute:
python publisher.py siva-poc publish "projects/siva-poc/topics/sample_topic"
Traceback (most recent call last):
File "publisher.py", line 275, in
publish_messages(publisher,args.project_id, args.topic_name)
File "publisher.py", line 93, in publish_messages
future = publisher.publish(topic_path, data=data)
TypeError: publish() got an unexpected keyword argument 'data'
I tried a different operation "publish-with-custom-attributes" but it still complains:
python publisher.py siva-poc publish-with-custom-attributes "projects/siva-poc/topics/sample_topic"
Traceback (most recent call last):
File "publisher.py", line 278, in
args.project_id, args.topic_name)
File "publisher.py", line 125, in publish_messages_with_custom_attributes
topic_path, data, origin='python-sample', username='gcp')
TypeError: publish() got an unexpected keyword argument 'origin'
I am not sure why is it complaining about the argument in the publisher_client.
Could someone help me with this, please?
The text was updated successfully, but these errors were encountered: