Skip to content

[BUG] Custom request session's verify parameter gets overwritten #1559

@pmarko1711

Description

@pmarko1711

When I create (in my case a Jira) connection to which I pass a custom requests.Session object that has its verify set to a path, the client overrides this path in the passed session object with True coming from the default value of verify_ssl.

I need to set up a path to trust a self-signed certificate presented by a proxy server. Though with this override, I get an SSL error.

Example:

custom_session = requests.Session()
custom_session.verify = "<somepath>"

jira = Jira(
    url=jira_url,
    username=atlassian_username,
    password=atlassian_api_token,
    cloud=True,
    session=custom_session
)

jql = 'project = ABC ORDER BY created DESC'
issues = jira.jql(jql)

Error

requests.exceptions.SSLError: HTTPSConnectionPool(host='<redacted>.atlassian.net', port=443): Max retries exceeded with url: /rest/api/2/search/jql?fields=%2Aall&jql=project+%3D+ABC+ORDER+BY+created+DESC (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1028)')))

Workaround

One can set verify_ssl to the desired path, with the effect of overriding session's verify parameter with the desired value, but that's not nice and
also not inline with your documentation where it's claimed to be a bool.

jira = Jira(
    url=jira_url,
    username=atlassian_username,
    password=atlassian_api_token,
    cloud=True,
    session=custom_session,
    verify_ssl="<somepath>"
)

Suggestion

I'd be better not to overwrite session's verify parameter if it's a custom session object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions