Skip to content
Myr

environment.py

This file

Path

httpcore/environment.py

27 lines · 790 bytes · Python

Last changed by

AdaptersTom Christiebefore adoptionfab6fcd

History of this file

Take it

1import typing23from .adapters import Adapter4from .models import Request, Response567class EnvironmentAdapter(Adapter):8    def __init__(self, dispatch: Adapter, trust_env: bool = True):9        self.dispatch = dispatch10        self.trust_env = trust_env1112    def prepare_request(self, request: Request) -> None:13        self.dispatch.prepare_request(request)1415    async def send(self, request: Request, **options: typing.Any) -> Response:16        if self.trust_env:17            self.merge_environment_options(options)18        return await self.dispatch.send(request, **options)1920    async def close(self) -> None:21        await self.dispatch.close()2223    def merge_environment_options(self, options: dict) -> None:24        """25        Add environment options.26        """27        #  TODO