阅读背景:

从谷歌云Pub/Sub而不是base64获取未编码的数据

来源:互联网 

I'm attempting to use the Python library for Pub/Sub, but I keep getting this error: TypeError: Incorrect padding. Some quick googling revealed this issue: https://github.com/GoogleCloudPlatform/google-cloud-python/pull/2527

我正在尝试为Pub/Sub使用Python库,但是我不断地得到这个错误:TypeError:不正确的填充。一些人在谷歌上很快发现了这个问题:https://github.com/googlecloudplatform/googile -cloud-python/pull/2527

However, this doesn't resolve the issue - in fact, printing out the data revealed that the data was not even base64 encoded at all, and setting data = raw_data in the library resolved the issue.

然而,这并不能解决问题——事实上,打印出的数据显示数据甚至根本不是经过base64编码的,并且在库中设置data = raw_data解决了这个问题。

We're sending the message from Java, here is the code we're using:

我们正在从Java发送消息,这里是我们正在使用的代码:

PCollection<String> userActionsJson = userActionsRaw.apply(ParDo.of(new BigQueryRowToJson()));
       String topicNameFull = "projects/" + options.getProject() + "/topics/" +
               options.getUsersActionsTopicName() + "-" + options.getProduct();
       userActionsJson.apply(PubsubIO.Write.named("PublishToPubSub")
               .topic(topicNameFull));

however, the same thing happens attempting to send a message through the console.

然而,尝试通过控制台发送消息也会发生同样的事情。

Has something changed recently to mean that data is no longer base64 encoded?

最近有什么变化意味着数据不再是base64编码的吗?

1 个解决方案

#1


5  

This was an issue that has now been resolved in master: https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2577

这个问题现在已经在master中得到了解决:https://github.com/googlecloudplatform/googile -cloud-python/issues/2577


分享到: