简体   繁体   中英

Getting error while adding watcher to JIRA ticket using JIRA python API

I'm trying to add watchers after creating the issue using python but while adding into after creating issue getting below error, Can anyone help?

TypeError: unbound method add_watcher() must be called with JIRA instance as first argument (got unicode instance instead)

Code:

def aus_issue(self):
    self.issue_aus = {
        'project': {'key': 'MOS'},
        'issuetype': {'name': 'Reporting'},
        'summary': 'Test NDP Data Audit {} AUS'.format(Jira.date_create().strftime('%B')),
        'description': self.description,
        'customfield_10038': {'value': 'AUS'},
        'customfield_10052': {'value': 'Ad hoc'},
        'customfield_10053': {'value': 'Monthly'},
        "assignee": {
            "name": ""
        }, 'duedate': str(Jira.sixth_day())}

    self.create_aus = self.client.create_issue(fields=self.issue_aus, prefetch=True)
    JIRA.add_watcher(self.create_aus.id, watcher='UserName')

In your code, the instance of JIRA class is: "self.client"

For add_watcher, you need to use it as: self.client.add_watcher(self.create_aus.id, watcher='UserName')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM