File: _tls_util.py

package info (click to toggle)
dnspython 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,556 kB
  • sloc: python: 37,194; sh: 7; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license

import os
from typing import Tuple


def convert_verify_to_cafile_and_capath(
    verify: bool | str,
) -> Tuple[str | None, str | None]:
    cafile: str | None = None
    capath: str | None = None
    if isinstance(verify, str):
        if os.path.isfile(verify):
            cafile = verify
        elif os.path.isdir(verify):
            capath = verify
        else:
            raise ValueError("invalid verify string")
    return cafile, capath