Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding parameter verify_ssl #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion zammad_py/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import atexit
from abc import ABC, abstractmethod
from contextlib import contextmanager
from typing import Any, Generator, List, Optional, Tuple
from typing import Any, Generator, List, Optional, Tuple, Union

import requests
from requests.exceptions import HTTPError
Expand All @@ -22,6 +22,7 @@ def __init__(
oauth2_token: Optional[str] = None,
on_behalf_of: Optional[str] = None,
additional_headers: Optional[List[Tuple[str, str]]] = None,
verify_ssl: Optional[Union[bool, str]] = True,
) -> None:
self.url = url if url.endswith("/") else f"{url}/"
self._username = username
Expand All @@ -30,6 +31,7 @@ def __init__(
self._oauth2_token = oauth2_token
self._on_behalf_of = on_behalf_of
self._additional_headers = additional_headers
self._verify_ssl = verify_ssl or True
self._check_config()

self.session = requests.Session()
Expand All @@ -51,6 +53,9 @@ def __init__(
for additional_header in self._additional_headers:
self.session.headers[additional_header[0]] = additional_header[1]

if self._verify_ssl is not True:
self.session.verify = self._verify_ssl

def _check_config(self) -> None:
"""Check the configuration"""
if not self.url:
Expand Down
Loading