Skip to content

Commit

Permalink
Bump version to 0.7.2, close #389
Browse files Browse the repository at this point in the history
  • Loading branch information
lexiforest committed Sep 24, 2024
1 parent eea70a1 commit ee93744
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions docs/cookies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ How to save and load cookies
Do not use ``get_dict`` to dump and load cookies. Cookies are more than just plain
key-value pairs.

Using pickle:

.. code-block:: python
# example from: https://github.com/encode/httpx/issues/895
import pickle
# import httpx
from curl_cffi import requests
def save_cookies(client):
with open("cookies.pk", "wb") as f:
pickle.dump(client.cookies.jar, f)
pickle.dump(client.cookies.jar._cookies, f)
def load_cookies():
if not os.path.isfile("cookies.pk"):
Expand All @@ -24,5 +27,17 @@ key-value pairs.
return pickle.load(f)
# client = httpx.Client(cookies=load_cookies())
client = requests.Session(cookies=load_cookies())
client = requests.Session()
client.get("https://httpbin.org/cookies/set/foo/bar")
save_cookies(client)
client = requests.Session()
client.cookies.jar._cookies.update(load_cookies())
print(client.cookies.get("foo"))
Using mozilla cookie jar:

See: https://github.com/lexiforest/curl_cffi/issues/381

TODO: expose libcurl's native cookies.txt support.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[project]
name = "curl_cffi"
version = "0.7.1"
version = "0.7.2"
authors = [{ name = "Lyonnet", email = "[email protected]" }]
description = "libcurl ffi bindings for Python, with impersonation support."
license = { file = "LICENSE" }
dependencies = [
"cffi>=1.12.0",
"certifi>=2024.2.2",
"typing_extensions",
]
readme = "README.md"
requires-python = ">=3.8"
Expand Down

0 comments on commit ee93744

Please sign in to comment.