ValueError:字典更新序列元素#0的长度为1; 2个为必填项1

时间:2018-07-27 06:39:16

标签: python jira config

我的英语不好。对不起。

我想链接到JIRA和Python。

以下代码有效:

from jira.client import JIRA

jira_options={'server': 'http://xxxxxxxxxxx'}

print(jira_options)
jira=JIRA(options=jira_options,basic_auth=('xxxxx','xxxxxx'))

issue = jira.issue('Demo-24')
print (issue.fields.project.key)
print (issue.fields.issuetype.name)
print (issue.fields.reporter.displayName)

config.ini文件:

  [DEFAULT]

ADMIN_NAME ='admin'
PASSWORD ='password'
JIRA_URL ='http://xxxxxxxxxxx'
#jira_options={'server': 'http://xxxxxxxx'}

config.py文件:

import configparser
from jira import JIRA

config = configparser.ConfigParser()
config.read('config.ini')

JIRA_URL = config['DEFAULT']['JIRA_URL']
PASSWORD = config['DEFAULT']['PASSWORD']
ADMIN_NAME = config['DEFAULT']['ADMIN_NAME']

# jira = JIRA(basic_auth=(ADMIN_NAME, PASSWORD), options={JIRA_URL})

jira=JIRA(options=JIRA_URL, basic_auth=(ADMIN_NAME, PASSWORD))

错误:

  

ValueError:字典更新序列元素#0的长度为1;需要2个

0 个答案:

没有答案