【问题标题】:How to attach file via "Bugzilla XMLRPC access module"如何通过“Bugzilla XMLRPC 访问模块”附加文件
【发布时间】:2014-01-10 18:18:13
【问题描述】:

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

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

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

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

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

任何帮助将不胜感激。

【问题讨论】:

    标签: python xml-rpc bugzilla


    【解决方案1】:

    仅供参考: 我正在与 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) 
    

    但是,由于hereherehere 描述的某些 xmp-rpc API 的内部方法,附件已损坏,这是另一个问题 :)

    【讨论】:

      猜你喜欢
      • 2011-07-27
      • 1970-01-01
      • 2018-03-15
      • 1970-01-01
      • 2020-11-06
      • 2011-12-12
      • 1970-01-01
      • 1970-01-01
      • 2023-03-07
      相关资源
      最近更新 更多