Skip to content

ValueError when trying to publish message (V 0.9) #1438

@asaidomar

Description

@asaidomar

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.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions