When using the full path of the topic like this:
class PubSubClient(CloudClient):
def __init__(self):
super().__init__()
client = pubsub.Client(
project=self.config.get("project"), credentials=self.credentials)
self.client = client.topic("/projects/myprojectname/topics/files.dev")
def publish(self, message):
self.client.publish(bytes(message, encoding="utf8"))
I got the following error:
File "C:\Python34\lib\json\decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python34\lib\json\decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
It's seem that the html response is decoded rather than the JSON response.
When using the trailing name of the topic "files.dev", the message is published.
When using the full path of the topic like this:
I got the following error:
It's seem that the html response is decoded rather than the JSON response.
When using the trailing name of the topic "files.dev", the message is published.