File: response.py

package info (click to toggle)
python-twilio 9.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,756 kB
  • sloc: python: 8,281; makefile: 65
file content (22 lines) | stat: -rw-r--r-- 518 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from typing import Any, Optional


class Response(object):
    def __init__(
        self,
        status_code: int,
        text: str,
        headers: Optional[Any] = None,
    ):
        self.content = text
        self.headers = headers
        self.cached = False
        self.status_code = status_code
        self.ok = self.status_code < 400

    @property
    def text(self) -> str:
        return self.content

    def __repr__(self) -> str:
        return "HTTP {} {}".format(self.status_code, self.content)