|
12 | 12 | from datetime import datetime |
13 | 13 | from enum import Enum |
14 | 14 | from threading import Condition, Lock |
15 | | -from typing import TYPE_CHECKING, Any, Callable, Deque, Dict, List, Optional, Tuple |
16 | | -from collections.abc import Iterable, Mapping |
| 15 | +from typing import TYPE_CHECKING, Any, Callable, Deque |
| 16 | +from collections.abc import Iterable |
17 | 17 | from urllib.parse import quote as urlescape |
18 | 18 |
|
19 | 19 | import requests |
@@ -175,7 +175,7 @@ class ResourceOpts(BaseModel): |
175 | 175 | model_config = ConfigDict(arbitrary_types_allowed=True) |
176 | 176 |
|
177 | 177 | def to_dict(self) -> dict[str, Any]: |
178 | | - res = self.dict() |
| 178 | + res = self.model_dump() |
179 | 179 | # Compensate for the 'alias' field options |
180 | 180 | res['as'] = res.pop('alias') |
181 | 181 | res['validate'] = res.pop('validate_schema') |
@@ -208,7 +208,7 @@ def _format_key(k: str) -> str: |
208 | 208 | # Turn validation_errors into 'Validation Errors' |
209 | 209 | return k.replace('_', ' ').title() |
210 | 210 |
|
211 | | - res = {_format_key(k): v for k, v in self.dict().items()} |
| 211 | + res = {_format_key(k): v for k, v in self.model_dump().items()} |
212 | 212 |
|
213 | 213 | if self.parser_info: |
214 | 214 | # Move contents from sub-dict to top of dict, for backwards compatibility |
@@ -475,7 +475,7 @@ def parse(self, getter: Callable[[str], Response]) -> Deque[Resource]: |
475 | 475 | if self.post: |
476 | 476 | for cb in self.post: |
477 | 477 | if self.t is not None: |
478 | | - n_t = cb(self.t, self.opts.dict()) |
| 478 | + n_t = cb(self.t, self.opts.model_dump()) |
479 | 479 | if n_t is None: |
480 | 480 | log.warn(f'callback did not return anything when parsing {self.url} {info}') |
481 | 481 | self.t = n_t |
|
0 commit comments