MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / save

Method save

tools/python-3.11.9-amd64/Lib/http/cookiejar.py:1888–1901  ·  view source on GitHub ↗
(self, filename=None, ignore_discard=False, ignore_expires=False)

Source from the content-addressed store, hash-verified

1886 return "\n".join(r+[""])
1887
1888 def save(self, filename=None, ignore_discard=False, ignore_expires=False):
1889 if filename is None:
1890 if self.filename is not None: filename = self.filename
1891 else: raise ValueError(MISSING_FILENAME_TEXT)
1892
1893 with os.fdopen(
1894 os.open(filename, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o600),
1895 'w',
1896 ) as f:
1897 # There really isn't an LWP Cookies 2.0 format, but this indicates
1898 # that there is extra information in here (domain_dot and
1899 # port_spec) while still being compatible with libwww-perl, I hope.
1900 f.write("#LWP-Cookies-2.0\n")
1901 f.write(self.as_lwp_str(ignore_discard, ignore_expires))
1902
1903 def _really_load(self, f, filename, ignore_discard, ignore_expires):
1904 magic = f.readline()

Callers

nothing calls this directly

Calls 3

as_lwp_strMethod · 0.95
openMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected