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
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install --upgrade pip
python -m pip install flake8
- name: Check
run: python -m flake8
Expand All @@ -38,10 +38,10 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v7.0.0
with:
python-version: '3.13'
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install --upgrade pip
python -m pip install mypy .[all]
- name: Check
run: python -m mypy --install-types --non-interactive
Expand All @@ -55,6 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
httpx: [ 'httpx', 'httpx2' ]
python:
- '3.9'
- '3.10'
Expand All @@ -76,10 +77,12 @@ jobs:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel
python -m pip install -U .[all] pytest-cov codecov
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
python -m pip install --upgrade .[all] pytest-cov codecov
- name: Run Tests
env:
HTTPX: ${{ matrix.httpx }}
run: python -m pytest --cov=httpx_gssapi --cov-report=xml
- name: Upload Coverage
run: python -m codecov --token=${{ secrets.CODECOV_TOKEN }}
Expand All @@ -97,11 +100,11 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v7.0.0
with:
python-version: '3.10'
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
- name: Build
run: python setup.py sdist bdist_wheel
- name: Change Log
Expand Down
2 changes: 1 addition & 1 deletion httpx_gssapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
of requests_gssapi to HTTPX and adds optional GSSAPI authentication support and
supports mutual authentication. Basic GET usage:

>>> import httpx
>>> import httpx # or `import httpx2`
>>> from httpx_gssapi import HTTPSPNEGOAuth
>>> r = httpx.get("http://example.org", auth=HTTPSPNEGOAuth())

Expand Down
6 changes: 5 additions & 1 deletion httpx_gssapi/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@

"""

from os import getenv
from typing import Optional

from httpx import RequestError, Request, Response
if getenv("HTTPX") == "httpx2":
from httpx2 import RequestError, Request, Response
else:
from httpx import RequestError, Request, Response # type: ignore[assignment]


class MutualAuthenticationError(RequestError):
Expand Down
9 changes: 7 additions & 2 deletions httpx_gssapi/gssapi_.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
from itertools import chain
from functools import wraps
from os import getenv
from typing import Generator, Optional, List, Any, Union

from base64 import b64encode, b64decode
Expand All @@ -10,8 +11,12 @@
from gssapi import SecurityContext
from gssapi.exceptions import GSSError

import httpx
from httpx import Auth, Request, Response
if getenv("HTTPX") == "httpx2":
import httpx2 as httpx
from httpx2 import Auth, Request, Response
else:
import httpx # type: ignore[no-redef]
from httpx import Auth, Request, Response # type: ignore[assignment]

from .exceptions import MutualAuthenticationError, SPNEGOExchangeError

Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ python_requires = >=3.9
packages = httpx_gssapi
install_requires =
httpx>=0.16,<0.29
httpx2
gssapi

[options.extras_require]
Expand Down Expand Up @@ -83,7 +84,7 @@ packages =
tests

[tox:tox]
envlist = py36, py37, py38, py39, py310
envlist = py39, py310, py311, py312, py313, py314, py315

[testenv]
deps =
Expand Down
8 changes: 7 additions & 1 deletion tests/test_end_to_end.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env python
"""Tests for httpx_gssapi."""

from os import getenv

if getenv("HTTPX") == "httpx2":
import httpx2 as httpx
else:
import httpx # type: ignore[no-redef]
import gssapi
import httpx
import k5test # type: ignore[import-untyped]
import pytest

Expand Down
6 changes: 5 additions & 1 deletion tests/test_mocked.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

import logging
from base64 import b64encode
from os import getenv
from unittest.mock import Mock, patch

import pytest

import httpx
if getenv("HTTPX") == "httpx2":
import httpx2 as httpx
else:
import httpx # type: ignore[no-redef]

import gssapi
import gssapi.exceptions
Expand Down
Loading