Skip to main content
 首页 » 编程设计

python之如何使用鼠兔通过rabbitmq发送文件

2025年05月04日26jiqing9006

我已经浏览了 rabbitmq 上的教程并发现它很有用。

但是我找不到文档告诉我如何使用 pika 通过 rabbitmq 发送文件。

代码示例优先,除pika以外的其他库也可以。

请您参考如下方法:

我已使用 base64encode 完成此操作。

我构建了一个 json 对象 - 示例:

data = { 
filname = 'myfile.txt', 
b64 = 'the base64 representation of the file' 
} 

然后,在消费者端

base64解码:)