Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Add cert parameter to support SSL
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmackaij committed Aug 28, 2022
1 parent 122854a commit 49555dc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
7 changes: 2 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name="robotframework-openapidriver"
version = "3.3.0"
version = "3.4.0"
description = "A library for contract-testing OpenAPI / Swagger APIs."
license = "Apache-2.0"
authors = ["Robin Mackaij <[email protected]>"]
Expand Down
4 changes: 3 additions & 1 deletion src/OpenApiDriver/openapi_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from logging import getLogger
from pathlib import Path
from random import choice
from typing import Any, Dict, List, Optional, Union
from typing import Any, Dict, List, Optional, Tuple, Union

from openapi_core.contrib.requests import (
RequestsOpenAPIRequest,
Expand Down Expand Up @@ -49,6 +49,7 @@ def __init__( # pylint: disable=too-many-arguments, dangerous-default-value
password: str = "",
security_token: str = "",
auth: Optional[AuthBase] = None,
cert: Optional[Union[str, Tuple[str, str]]] = None,
extra_headers: Optional[Dict[str, str]] = None,
response_validation: ValidationLevel = ValidationLevel.WARN,
disable_server_validation: bool = True,
Expand All @@ -67,6 +68,7 @@ def __init__( # pylint: disable=too-many-arguments, dangerous-default-value
password=password,
security_token=security_token,
auth=auth,
cert=cert,
extra_headers=extra_headers,
recursion_limit=recursion_limit,
recursion_default=recursion_default,
Expand Down
10 changes: 8 additions & 2 deletions src/OpenApiDriver/openapidriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"""
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from typing import Any, Dict, List, Optional, Tuple, Union

from DataDriver import DataDriver
from requests.auth import AuthBase
Expand Down Expand Up @@ -154,6 +154,7 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals, dangerous-
password: str = "",
security_token: str = "",
auth: Optional[AuthBase] = None,
cert: Optional[Union[str, Tuple[str, str]]] = None,
extra_headers: Optional[Dict[str, str]] = None,
response_validation: ValidationLevel = ValidationLevel.WARN,
disable_server_validation: bool = True,
Expand Down Expand Up @@ -198,9 +199,13 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals, dangerous-
The token to be used for token based security using the ``Authorization`` header.
=== auth ===
A [https://docs.python-requests.org/en/latest/api/#authentication | requests AuthBase instance]
A [https://requests.readthedocs.io/en/latest/api/#authentication | requests AuthBase instance]
to be used for authentication instead of the ``username`` and ``password``.
=== cert ===
The SSL certificate to use with all requests.
If string: the path to ssl client cert file (.pem). If tuple, ('cert', 'key') pair.
=== extra_headers ===
A dictionary with extra / custom headers that will be send with every request.
This parameter can be used to send headers that are not documented in the
Expand Down Expand Up @@ -266,6 +271,7 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals, dangerous-
password=password,
security_token=security_token,
auth=auth,
cert=cert,
extra_headers=extra_headers,
response_validation=response_validation,
disable_server_validation=disable_server_validation,
Expand Down

0 comments on commit 49555dc

Please sign in to comment.