python - 如何通过 "Bugzilla XMLRPC access module"附加文件

标签 python xml-rpc bugzilla

我正在使用Python开发的“Bugzilla XMLRPC access module ”来处理bugzilla xml-rpc。

如何使用此模块附加/下载 bugzilla 文件?

根据guideline of API get_attachments_by_bug($bug_id) 检索并返回附件。

但是这个功能对我不起作用,我收到以下错误消息。

<type 'exceptions.AttributeError'>: 'Bugzilla4' object has no attribute 'get_attachments_by_bug'

如有任何帮助,我们将不胜感激。

最佳答案

仅供引用: 我正在与 python-bugzilla 工具的供应商联系,在这里我得到了他们的回复。

“并非所有 bugzilla XMLRPC API 都由 python-bugzilla 封装,这就是其中之一。

python-bugzilla 附带的“bugzilla”命令行工具具有以下命令 附加文件和下载附件,看一下那里的代码 指导。”

<小时/>

我已经找到了如何使用“Bugzilla XMLRPC访问模块”下载/上传附件的方法

您需要将附加文件的 id 作为参数传递给以下函数

下载:

downloaded_file = bz.download_attachment(attachment_id)
file_name = str(downloaded_file.name)

上传:

kwards = {
    'contenttype':'application/octet-stream',
   # 'filename': file_path     #there could be more parameters if needed
} 

#attachfile method will return the id of attached file 
bz.attachfile(bug_id, file_path, file_name, **kwards) 

但是,由于描述的某些 xmp-rpc API 的内部方法,附加文件已损坏 here , herehere ,那是另一个问题了:)

关于python - 如何通过 "Bugzilla XMLRPC access module"附加文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19051376/

相关文章:

java - 此错误 "Unable to create a XML-RPC client"的解决方案是什么?

post - 在 Gravatar 上用于 POST 请求 https xml-rpc 的 Bash 脚本

perl - 安装 bugzilla 时出错 - 您必须安装 Linux::Pid

git - 安装 Gitzilla 时的 PyBugz 版本

mysql - bugzilla: install-module.pl GD 返回显示错误

python - 如何使用 argparse 创建类型为 "list of pairs"的参数?

python - 为什么 @property 中断了与代理类上的源对象的同步

python - 如何填充 numpy 数组的 "partial diagonal axis"

php - faultCode 105 faultString XML 错误 : Invalid document end at line 1, 第 1 列

python - 过滤/子请求以获得结果