我正在使用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 , here和 here ,那是另一个问题了:)
关于python - 如何通过 "Bugzilla XMLRPC access module"附加文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19051376/