Cache JIRA basic authentication sessions to disk for console apps.
Do you have command line applications which interact with JIRA servers? Do your users have to enter their credentials every time they run your applications? Are you unable to use OAuth because your command line application is open sourced or you have no way of securing the consumer secret?
Hi, Robpol86 here for jira-context. The easy way to prompt for credentials and cache session cookies on your clients’ workstations.
jira-context is supported on Python 2.6, 2.7, 3.3, and 3.4.
pip install jira-context
# example.py from __future__ import print_function import sys from jira_context import JIRA server = 'https://jira.company.local' query = 'assignee = currentUser() AND resolution = Unresolved' if len(sys.argv) == 2: JIRA.FORCE_USER = sys.argv print('Connecting to: ' + server) with JIRA(server=server) as j: if j.ABORTED_BY_USER: print('Aborted by user.', file=sys.stderr) sys.exit(1) issues = j.search_issues(query, maxResults=5) for issue in issues: 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+
These attributes/variables are persisted throughout the lifetime of the currently running process. If you’ve got two with blocks and ABORTED_BY_USER becomes True in the first one, the second block will skip authentication.
|ABORTED_BY_USER||False by default. Becomes True if USER_CAN_ABORT is True and the user enters a blank username or password.|
|COOKIE_CACHE_FILE_PATH||File path to the cache file used to store the base64 encoded session cookie.|
|FORCE_USER||If set to a string, user won’t be prompted for their username.|
|USER_CAN_ABORT||Set to False if you don’t want the user to continue without a JIRA session if they enter a blank user/pass.|
These attributes are persisted only in the current JIRA() instance.
|prompt_for_credentials||Instantiate with False if you don’t want the user prompted for credentials (useful in threads).|
|authentication_failed||Becomes True if prompt_for_credentials is False and cached cookies were invalid/missing.|
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash||File type||Python version||Upload date|
|jira-context-1.0.0.tar.gz (7.0 kB) View hashes||Source||None|