TypeError:使用JIRA API时,'instancemethod'对象是unsubscriptable

时间:2014-03-19 22:39:15

标签: python json

我的代码是:

import requests
import json
import sys
import re
import datetime
baseUrl = 'https://jira01.zz.com:8443/'
api='rest/api/2/search?jql='
jiraUser = 'qqqqq'
jiraPassword = 'qqqq123'

date_today = datetime.date.today()
date_tomorrow = date_today + datetime.timedelta(days=1)
print date_today
print date_tomorrow
message = "Alert for qq.com"

jql = 'project IN (SYS) AND status IN (Open, "In Progress", Reopened) AND labels IN (sys-status) AND createdDate >= "%s" and createdDate < "%s" AND Summary ~ "%s"' % (date_today, date_tomorrow, message)
maxResults = '1'
output = requests.get(baseUrl+api+jql+maxResults,auth=(jiraUser,jiraPassword),verify=False)
if output.json['issues']:
        print baseUrl+'browse/'+output.json['issues'][0]['key']
else:
        print "No ticket"

我收到以下错误: 2014年3月19日 2014年3月20日 Traceback(最近一次调用最后一次):   文件“test10_jql.py”,第22行,in     如果output.json ['issues']: TypeError:'instancemethod'对象是unsubscriptable

1 个答案:

答案 0 :(得分:0)

output.json是一种方法,而不是数据属性。你需要打电话。