Skip to main content

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.

Build Status Coverage Status Latest Version Downloads Download format License

Quickstart

Install:

pip install jira-context

Usage

# 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[1]

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+

Class Attributes

Persisted

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.

Name

Description/Notes

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.

Instance

These attributes are persisted only in the current JIRA() instance.

Name

Description/Notes

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.

Metadata

Release files for jira-context 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jira-context 1.0.0
File Size Uploaded
jira-context-1.0.0.tar.gz 7.0 kB Details

Release files / jira-context-1.0.0.tar.gz

Download URL jira-context-1.0.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
21e66f592bd3a1b1fde0240dba6766c9baccf0c619b473f749089ef886e69f94
BLAKE2b-256 checksum
How to use checksums
b7e19f8fb988586ed368ed993180f525f2f11b611079c36ba0cc7dc4794286a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page