anti-cf 1.1.0__tar.gz → 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {anti_cf-1.1.0 → anti_cf-1.1.1}/PKG-INFO +1 -1
- {anti_cf-1.1.0 → anti_cf-1.1.1}/pyproject.toml +1 -1
- {anti_cf-1.1.0 → anti_cf-1.1.1}/src/anti_cf/_persistent_session.py +4 -3
- {anti_cf-1.1.0 → anti_cf-1.1.1}/README.md +0 -0
- {anti_cf-1.1.0 → anti_cf-1.1.1}/src/anti_cf/__init__.py +0 -0
- {anti_cf-1.1.0 → anti_cf-1.1.1}/src/anti_cf/_constants.py +0 -0
- {anti_cf-1.1.0 → anti_cf-1.1.1}/src/anti_cf/_flaresolverr.py +0 -0
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import pickle
|
4
4
|
import tempfile
|
5
|
+
from pathlib import Path
|
5
6
|
from typing import TYPE_CHECKING, ClassVar
|
6
7
|
|
7
8
|
import fake_useragent
|
@@ -22,8 +23,6 @@ except ImportError:
|
|
22
23
|
_HAS_CACHE = False
|
23
24
|
|
24
25
|
if TYPE_CHECKING:
|
25
|
-
from pathlib import Path
|
26
|
-
|
27
26
|
from requests import Response
|
28
27
|
|
29
28
|
|
@@ -80,7 +79,9 @@ class PersistentSession(Session):
|
|
80
79
|
|
81
80
|
def save_cookies(self) -> None:
|
82
81
|
"""Save current cookies to file."""
|
83
|
-
|
82
|
+
temp_file = Path(tempfile.mktemp(dir=self._COOKIES_FILE.parent))
|
83
|
+
temp_file.write_bytes(pickle.dumps(self.cookies, protocol=4))
|
84
|
+
temp_file.replace(self._COOKIES_FILE)
|
84
85
|
|
85
86
|
def request(self, *args: object, **kwargs: object) -> Response:
|
86
87
|
"""Override request method to save cookies after each request."""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|