'Construct a JIRA client instance.
Without any arguments, this client will connect anonymously to the JIRA instance
started by the Atlassian Plugin SDK from one of the \'atlas-run\', ``atlas-debug``,
or ``atlas-run-standalone`` commands. By default, this instance runs at
``http://localhost:2990/jira``. The ``options`` argument can be used to set the JIRA instance to use.
Authentication is handled with the ``basic_auth`` argument. If authentication is supplied (and is
accepted by JIRA), the client will remember it for subsequent requests.
For quick command line access to a server, see the ``jirashell`` script included with this distribution.
The easiest way to instantiate is using j = JIRA("https://jira.atlasian.com")
:param options: Specify the server and properties this client will use. Use a dict with any
of the following properties:
* server -- the server address and context path to use. Defaults to ``http://localhost:2990/jira``.
* rest_path -- the root REST path to use. Defaults to ``api``, where the JIRA REST resources live.
* rest_api_version -- the version of the REST resources under rest_path to use. Defaults to ``2``.
* agile_rest_path - the REST path to use for JIRA Agile requests. Defaults to ``greenhopper`` (old, private
API). Check `GreenHopperResource` for other supported values.
* verify -- Verify SSL certs. Defaults to ``True``.
* client_cert -- a tuple of (cert,key) for the requests library for client side SSL
* check_update -- Check whether using the newest python-jira library version.
:param basic_auth: A tuple of username and password to use when establishing a session via HTTP BASIC
authentication.
:param oauth: A dict of properties for OAuth authentication. The following properties are required:
* access_token -- OAuth access token for the user
* access_token_secret -- OAuth access token secret to sign with the key
* consumer_key -- key of the OAuth application link defined in JIRA
* key_cert -- private key file to sign requests with (should be the pair of the public key supplied to
JIRA in the OAuth application link)
:param kerberos: If true it will enable Kerberos authentication.
:param jwt: A dict of properties for JWT authentication supported by Atlassian Connect. The following
properties are required:
* secret -- shared secret as delivered during \'installed\' lifecycle event
(see https://developer.atlassian.com/static/connect/docs/latest/modules/lifecycle.html for details)
* payload -- dict of fields to be inserted in the JWT payload, e.g. \'iss\'
Example jwt structure: ``{\'secret\': SHARED_SECRET, \'payload\': {\'iss\': PLUGIN_KEY}}``
:param validate: If true it will validate your credentials first. Remember that if you are accesing JIRA
as anononymous it will fail to instanciate.
:param get_server_info: If true it will fetch server version info first to determine if some API calls
are available.
:param async: To enable async requests for those actions where we implemented it, like issue update() or delete().
:param timeout: Set a read/connect timeout for the underlying calls to JIRA (default: None)
Obviously this means that you cannot rely on the return code when this is enabled.'

def __init__(self, server=None, options=None, basic_auth=None, oauth=None, jwt=None, kerberos=False, validate=False, get_server_info=True, async=False, logging=True, max_retries=3, proxies=None, timeout=None):

    self.sys_version_info = tuple([i for i in sys.version_info])
    if (options is None):
        options = {}
        if (server and hasattr(server, u'keys')):
            warnings.warn(u"Old    API    usage,    use    JIRA(url)    or    JIRA(options={'server':    url},    when    using    dictionary    always    use    named    parameters.", DeprecationWarning)
            options = server
            server = None
    if server:
        options[u'server'] = server
    if async:
        options[u'async'] = async
    self.logging = logging
    self._options = copy.copy(JIRA.DEFAULT_OPTIONS)
    self._options.update(options)
    self._rank = None
    if self._options[u'server'].endswith(u'/'):
        self._options[u'server'] = self._options[u'server'][:(-1)]
    context_path = urlparse(self._options[u'server']).path
    if (len(context_path) > 0):
        self._options[u'context_path'] = context_path
    self._try_magic()
    if oauth:
        self._create_oauth_session(oauth, timeout)
    elif basic_auth:
        self._create_http_basic_session(timeout=timeout, *basic_auth)
        self._session.headers.update(self._options[u'headers'])
    elif jwt:
        self._create_jwt_session(jwt, timeout)
    elif kerberos:
        self._create_kerberos_session(timeout)
    else:
        verify = self._options[u'verify']
        self._session = ResilientSession(timeout=timeout)
        self._session.verify = verify
    self._session.headers.update(self._options[u'headers'])
    self._session.max_retries = max_retries
    if proxies:
        self._session.proxies = proxies
    if validate:
        user = self.session()
        if (user.raw is None):
            auth_method = (oauth or basic_auth or jwt or kerberos or u'anonymous')
            raise JIRAError((u'Can    not    log    in    with    %s' % str(auth_method)))
    self.deploymentType = None
    if get_server_info:
        si = self.server_info()
        try:
            self._version = tuple(si[u'versionNumbers'])
        except Exception as e:
            logging.error(u'invalid    server_info:    %s', si)
            raise e
        self.deploymentType = si.get(u'deploymentType')
    else:
        self._version = (0, 0, 0)
    if (self._options[u'check_update'] and (not JIRA.checked_version)):
        self._check_update_()
        JIRA.checked_version = True
    self._fields = {}
    for f in self.fields():
        if (u'clauseNames' in f):
            for name in f[u'clauseNames']:
                self._fields[name] = f[u'id']
