Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
the-ress committed Feb 9, 2024
1 parent ffd4298 commit 2055104
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyprusalink/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
from contextlib import asynccontextmanager
import hashlib

from httpx import AsyncClient, DigestAuth, Response, Request
from httpx import AsyncClient, DigestAuth, Request, Response
from httpx._auth import _DigestAuthChallenge
from pyprusalink.types import Conflict, InvalidAuth, NotFound


# TODO remove after the following issues are fixed (in all supported firmwares for the latter one):
# https://github.com/encode/httpx/pull/3045
# https://github.com/prusa3d/Prusa-Firmware-Buddy/pull/3665
class DigestAuthWorkaround(DigestAuth):
"""Wrapper for httpx.DigestAuth to work around a firmware issue."""

# Taken from httpx.DigestAuth and modified
# https://github.com/encode/httpx/blob/c6907c22034e2739c4c1af89908e3c9f90602788/httpx/_auth.py#L258
def _build_auth_header(
Expand Down Expand Up @@ -43,6 +46,7 @@ def digest(data: bytes) -> bytes:

return "Digest " + self._get_header_value(format_args)


class ApiClient:
def __init__(
self, async_client: AsyncClient, host: str, username: str, password: str
Expand Down

0 comments on commit 2055104

Please sign in to comment.