Skip to content

intel

dandy.http.intel

HttpResponseIntel

Bases: BaseIntel

status_code instance-attribute

response_phrase instance-attribute

text instance-attribute

json instance-attribute

as_httpx

Source code in dandy/http/intel.py
def as_httpx(self) -> httpx.Response:
    pass

HttpRequestIntel

Bases: BaseIntel

method instance-attribute

url instance-attribute

params = None class-attribute instance-attribute

headers = None class-attribute instance-attribute

cookies = None class-attribute instance-attribute

content = None class-attribute instance-attribute

data = None class-attribute instance-attribute

files = None class-attribute instance-attribute

json = None class-attribute instance-attribute

stream = None class-attribute instance-attribute

as_httpx

Source code in dandy/http/intel.py
def as_httpx(self) -> httpx.Request:
    return httpx.Request(
        **self.model_dump()
    )

get_response_intel

Source code in dandy/http/intel.py
def get_response_intel(self) -> HttpResponseIntel:
    with httpx.Client() as client:
        httpx_response = client.send(
            self.as_httpx()
        )

        return HttpResponseIntel(
            status_code=httpx_response.status_code,
            response_phrase=httpx_response.reason_phrase,
            text=httpx_response.text,
            json=httpx_response.json()
        )