Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ n = nomad.Nomad(host="172.16.100.10", secure=True, timeout=5, verify=True, cert=
# For HTTPS Nomad instances with cert file and key
n = nomad.Nomad(host="https://172.16.100.10", secure=True, timeout=5, verify=True, cert=("/path/to/certfile", "/path/to/key")) # See http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification

# For HTTPS Nomad instance with cert file and key and CA file
n = nomad.Nomad(host="https://172.16.100.10", secure=True, timeout=5, verify="/path/to/cacert", cert=("/path/to/certfile", "/path/to/key"))

# For HTTPS Nomad instances with namespace and acl token
n = nomad.Nomad(host="172.16.100.10", secure=True, timeout=5, verify=False, namespace='Namespace-example',token='3f4a0fcd-7c42-773c-25db-2d31ba0c05fe')

Expand Down
8 changes: 4 additions & 4 deletions nomad/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Nomad Python library"""

import os
from typing import Optional
from typing import Optional, Union

import requests

Expand All @@ -25,7 +25,7 @@ def __init__( # pylint: disable=too-many-arguments
timeout: int = 5,
region: Optional[str] = None,
version: str = "v1",
verify: bool = False,
verify: Union[bool, str] = False,
cert: tuple = (),
session: requests.Session = None,
):
Expand All @@ -39,8 +39,8 @@ def __init__( # pylint: disable=too-many-arguments
- user_agent (defaults None), custom user agent for requests to Nomad.
- secure (defaults False), define if the protocol is secured or not (https or http)
- version (defaults v1), version of the api of nomad.
- verify (defaults False), verify the certificate when tls/ssl is enabled
at nomad.
- verify (defaults False), verify SSL certificates for HTTPS requests. Can be a boolean to enable/disable
verification, or a string path to a CA certificate file.
- cert (defaults empty), cert, or key and cert file to validate the certificate
configured at nomad.
- region (defaults None), version of the region to use. It will be used then
Expand Down
4 changes: 2 additions & 2 deletions nomad/api/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Requester"""

from typing import Optional
from typing import Optional, Union

import requests

Expand All @@ -24,7 +24,7 @@ def __init__( # pylint: disable=too-many-arguments
token: Optional[str] = None,
timeout: int = 5,
version: str = "v1",
verify: bool = False,
verify: Union[bool, str] = False,
cert: tuple = (),
region: Optional[str] = None,
session: requests.Session = None,
Expand Down