Skip to content
Open
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
14 changes: 7 additions & 7 deletions httpx_gssapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
Both the sync and async HTTPX APIs should be fully supported.
"""
__all__ = (
'DISABLED',
'OPTIONAL',
'REQUIRED',
'SPNEGO',
'HTTPSPNEGOAuth',
'MutualAuthenticationError',
'SPNEGO',
'REQUIRED',
'OPTIONAL',
'DISABLED',
)

import os
import logging
import os

from .gssapi_ import HTTPSPNEGOAuth, SPNEGO, REQUIRED, OPTIONAL, DISABLED
from ._version import get_versions
from .exceptions import MutualAuthenticationError
from .gssapi_ import DISABLED, OPTIONAL, REQUIRED, SPNEGO, HTTPSPNEGOAuth

from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

Expand Down
2 changes: 1 addition & 1 deletion httpx_gssapi/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"""Git implementation of _version.py."""

import errno
import functools
import os
import re
import subprocess
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple
import functools


def get_keywords() -> Dict[str, str]:
Expand Down
2 changes: 1 addition & 1 deletion httpx_gssapi/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from typing import Optional

from httpx import RequestError, Request, Response
from httpx import Request, RequestError, Response


class MutualAuthenticationError(RequestError):
Expand Down
15 changes: 7 additions & 8 deletions httpx_gssapi/gssapi_.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import re
import logging
from itertools import chain
import re
from base64 import b64decode, b64encode
from collections.abc import Generator
from functools import wraps
from typing import Generator, Optional, List, Any, Union

from base64 import b64encode, b64decode
from itertools import chain
from typing import Any, List, Optional, Union

import gssapi
import httpx
from gssapi import SecurityContext
from gssapi.exceptions import GSSError

import httpx
from httpx import Auth, Request, Response

from .exceptions import MutualAuthenticationError, SPNEGOExchangeError
Expand All @@ -36,7 +35,7 @@
# OID for the SPNEGO mechanism
SPNEGO = gssapi.OID.from_int_seq("1.3.6.1.5.5.2")

_find_auth = re.compile(r'Negotiate\s*([^,]*)', re.I).search
_find_auth = re.compile(r'Negotiate\s*([^,]*)', re.IGNORECASE).search


def _negotiate_value(response: Response) -> Optional[bytes]:
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python
from pathlib import Path

from setuptools import setup

import versioneer

path = Path(__file__).parent
Expand Down
16 changes: 8 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# TODO: Provide this through k5test?
import copy
import os
import re
import copy
import threading as th
from contextlib import contextmanager
from base64 import b64decode
from http.server import HTTPServer, BaseHTTPRequestHandler
from typing import Generator, cast

import pytest
import k5test # type: ignore[import-untyped]
from collections.abc import Generator
from contextlib import contextmanager
from http.server import BaseHTTPRequestHandler, HTTPServer
from typing import cast

import gssapi.exceptions
import k5test # type: ignore[import-untyped]
import pytest

WWW_AUTHENTICATE = 'WWW-Authenticate'
AUTHORIZATION = 'Authorization'
NEGOTIATE = 'Negotiate'

_find_auth = re.compile(r'Negotiate\s*([^,]*)', re.I).search
_find_auth = re.compile(r'Negotiate\s*([^,]*)', re.IGNORECASE).search


class KrbRequestHandler(BaseHTTPRequestHandler):
Expand Down
8 changes: 3 additions & 5 deletions tests/test_mocked.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
from base64 import b64encode
from unittest.mock import Mock, patch

import pytest

import httpx

import gssapi
import gssapi.exceptions
import httpx
import pytest

import httpx_gssapi
from httpx_gssapi import REQUIRED, OPTIONAL
from httpx_gssapi import OPTIONAL, REQUIRED

logging.basicConfig()

Expand Down
19 changes: 9 additions & 10 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,14 @@

import configparser
import errno
import functools
import json
import os
import re
import subprocess
import sys
from pathlib import Path
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
from typing import NoReturn
import functools
from typing import Any, Callable, Dict, List, NoReturn, Optional, Tuple, Union, cast

have_tomllib = True
if sys.version_info >= (3, 11):
Expand Down Expand Up @@ -1517,10 +1516,10 @@ def versions_from_file(filename: str) -> Dict[str, Any]:
except OSError:
raise NotThisMethod("unable to read _version.py")
mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON",
contents, re.M | re.S)
contents, re.MULTILINE | re.DOTALL)
if not mo:
mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON",
contents, re.M | re.S)
contents, re.MULTILINE | re.DOTALL)
if not mo:
raise NotThisMethod("no version_json in _version.py")
return json.loads(mo.group(1))
Expand Down Expand Up @@ -2233,7 +2232,7 @@ def scan_setup_py() -> int:
setters = False
errors = 0
with open("setup.py", "r") as f:
for line in f.readlines():
for line in f:
if "import versioneer" in line:
found.add("import")
if "versioneer.get_cmdclass()" in line:
Expand All @@ -2245,21 +2244,21 @@ def scan_setup_py() -> int:
if "versioneer.versionfile_source" in line:
setters = True
if len(found) != 3:
print("")
print()
print("Your setup.py appears to be missing some important items")
print("(but I might be wrong). Please make sure it has something")
print("roughly like the following:")
print("")
print()
print(" import versioneer")
print(" setup( version=versioneer.get_version(),")
print(" cmdclass=versioneer.get_cmdclass(), ...)")
print("")
print()
errors += 1
if setters:
print("You should remove lines like 'versioneer.VCS = ' and")
print("'versioneer.versionfile_source = ' . This configuration")
print("now lives in setup.cfg, and should be removed from setup.py")
print("")
print()
errors += 1
return errors

Expand Down
Loading