MCPcopy Index your code
hub / github.com/python/cpython / save

Method save

Lib/http/cookiejar.py:1889–1902  ·  view source on GitHub ↗
(self, filename=None, ignore_discard=False, ignore_expires=False)

Source from the content-addressed store, hash-verified

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

Callers 3

test_rejectionMethod · 0.95

Calls 3

as_lwp_strMethod · 0.95
openMethod · 0.45
writeMethod · 0.45

Tested by 3

test_rejectionMethod · 0.76