diff --git a/docs/request.md b/docs/request.md index ca717f3..8ebb414 100644 --- a/docs/request.md +++ b/docs/request.md @@ -66,3 +66,17 @@ Update query params of given url and return new url. >>> update_query_params('http://example.com', {'foo': 1}) 'http://example.com?foo=1' ``` + + +## request.cookies_str_to_dict +```python +cookies_str_to_dict(cookies) +``` + +Convert cookies from str to dict. + +```python +>>> from pydu.request import cookies_str_to_dict +>>> cookies_str_to_dict('a=a;b=b') +{'a': 'a', 'b': 'b'} +``` diff --git a/docs/zh-cn/request.md b/docs/zh-cn/request.md index 2b75be4..44ab1e4 100644 --- a/docs/zh-cn/request.md +++ b/docs/zh-cn/request.md @@ -62,3 +62,17 @@ update_query_params(url, params) >>> update_query_params('http://example.com', {'foo': 1}) 'http://example.com?foo=1' ``` + + +## request.cookies_str_to_dict +```python +cookies_str_to_dict(cookies) +``` + +将字符串类型的Cookies转换为字典对象。 + +```python +>>> from pydu.request import cookies_str_to_dict +>>> cookies_str_to_dict('a=a;b=b') +{'a': 'a', 'b': 'b'} +```