pyrestsdk.middleware package — PyRESTSDK documentation

# pyrestsdk.middleware package

## Subpackages

- pyrestsdk.middleware.authorizationhandler package
  - Module contents
    - `BasicAuthorizationHandler`
      - `BasicAuthorizationHandler.credential`
      - `BasicAuthorizationHandler.send()`
    - `KerboseAuthorizationHandler`
      - `KerboseAuthorizationHandler.credential`
      - `KerboseAuthorizationHandler.send()`
    - `TokenAuthorizationHandler`
      - `TokenAuthorizationHandler.credential`
      - `TokenAuthorizationHandler.send()`

## Module contents

Middleware

class pyrestsdk.middleware.BaseAuthorizationHandler(credential: C, /)

  Bases: `BaseMiddleware`

  Base Authorization Handler Type

  credential: C
  retry_count: int

class pyrestsdk.middleware.BaseMiddleware

  Bases: `HTTPAdapter`

  Base class for middleware

  Handles moving a Request to the next middleware in the pipeline. If the current middleware is the last one in the pipeline, it makes a network request

  next: B | None = None
  send(request: PreparedRequest, stream: bool = False, timeout: float | Tuple[float, float] | Tuple[float, None] | None = None, verify: bool = True, cert: bytes | str | Tuple[bytes | str, bytes | str] | None = None, proxies: Mapping[str, str] | None = None) → Response

    Makes a network request if next is none, otherwise requests the next middleware to do so

    Args:

      request (PreparedRequest): The network request

    Returns:

      Response: Response from network request

class pyrestsdk.middleware.MiddlewarePipeline

  Bases: `HTTPAdapter`

  MiddlewarePipeline, entry point of middleware The pipeline is implemented as a linked-list, read more about it here https://buffered.dev/middleware-python-requests/

  add_middleware(middleware: B) → None

    Adds middleware to the pipeline

  send(request: PreparedRequest, stream: bool = False, timeout=None, verify: bool = True, cert=None, proxies=None) → Response

    Sends the prepared request through the middleware pipeline