(
self,
path: Union[str, Path],
env: Environment,
bound_host: str,
session_id: str,
suppress_legacy_warnings: bool = False,
)
| 126 | about = 'HTTPie session file' |
| 127 | |
| 128 | def __init__( |
| 129 | self, |
| 130 | path: Union[str, Path], |
| 131 | env: Environment, |
| 132 | bound_host: str, |
| 133 | session_id: str, |
| 134 | suppress_legacy_warnings: bool = False, |
| 135 | ): |
| 136 | super().__init__(path=Path(path)) |
| 137 | |
| 138 | # Default values for the session files |
| 139 | self['headers'] = [] |
| 140 | self['cookies'] = [] |
| 141 | self['auth'] = { |
| 142 | 'type': None, |
| 143 | 'username': None, |
| 144 | 'password': None |
| 145 | } |
| 146 | |
| 147 | # Runtime state of the Session objects. |
| 148 | self.env = env |
| 149 | self._headers = HTTPHeadersDict() |
| 150 | self.cookie_jar = RequestsCookieJar( |
| 151 | # See also a temporary workaround for a Requests bug in `compat.py`. |
| 152 | policy=HTTPieCookiePolicy(), |
| 153 | ) |
| 154 | self.session_id = session_id |
| 155 | self.bound_host = bound_host |
| 156 | self.suppress_legacy_warnings = suppress_legacy_warnings |
| 157 | |
| 158 | def _add_cookies(self, cookies: List[Dict[str, Any]]) -> None: |
| 159 | for cookie in cookies: |
nothing calls this directly
no test coverage detected