将jira基本身份验证会话缓存到磁盘以用于控制台应用程序。
jira-context的Python项目详细描述
您有与jira服务器交互的命令行应用程序吗? 你的用户每次运行 应用?您不能使用oauth吗,因为您的命令行 应用程序是开源的,或者您无法保护消费者 秘密?
嗨,Robbol86这里是Jira的背景。提示的简单方法 客户端工作站上的凭据和缓存会话cookie。
jira-context在python 2.6、2.7、3.3和3.4上受支持。
快速启动
安装:
pip install jira-context
用法
# example.pyfrom__future__importprint_functionimportsysfromjira_contextimportJIRAserver='https://jira.company.local'query='assignee = currentUser() AND resolution = Unresolved'iflen(sys.argv)==2:JIRA.FORCE_USER=sys.argv[1]print('Connecting to: '+server)withJIRA(server=server)asj:ifj.ABORTED_BY_USER:print('Aborted by user.',file=sys.stderr)sys.exit(1)issues=j.search_issues(query,maxResults=5)forissueinissues:print(issue.key,issue.fields.summary)
$ python example.py Connecting to: https://jira.company.local JIRA username: does_not_exist JIRA password: Authentication failed or bad password, try again. JIRA username: Aborted by user. $ python example.py $USER Connecting to: https://jira.company.local JIRA password: FAKE-659 service solahart hp 082113812149 FAKE-620 Need new version to be compatible in Jira 6.3.1 FAKE-525 Half page become blank when Activity Stream gadget view as Wallboard FAKE-468 create page and with custom fields FAKE-022 As a burndown gadget I should support GH 6.0+ $ python example.py Connecting to: https://jira.company.local FAKE-659 service solahart hp 082113812149 FAKE-620 Need new version to be compatible in Jira 6.3.1 FAKE-525 Half page become blank when Activity Stream gadget view as Wallboard FAKE-468 create page and with custom fields FAKE-022 As a burndown gadget I should support GH 6.0+
类属性
持续
这些属性/变量在 当前正在运行的进程。如果你有两个 with块和ABORTED_BY_USER在第一个块中变为真, 第二个块将跳过身份验证。
Name | Description/Notes |
---|---|
^{tt3}$ | False by default. Becomes True if ^{tt5}$ is True and the user enters a blank username or password. |
^{tt6}$ | File path to the cache file used to store the base64 encoded session cookie. |
^{tt7}$ | If set to a string, user won’t be prompted for their username. |
^{tt5}$ | Set to False if you don’t want the user to continue without a JIRA session if they enter a blank user/pass. |
实例
这些属性仅在当前jira()实例中持久化。
Name | Description/Notes |
---|---|
^{tt9}$ | Instantiate with False if you don’t want the user prompted for credentials (useful in threads). |
^{tt10}$ | Becomes True if ^{tt9}$ is False and cached cookies were invalid/missing. |