From 3ee18155ecaa29b97f18c11d9befe6aceca384d5 Mon Sep 17 00:00:00 2001 From: Prodesire Date: Mon, 10 Dec 2018 21:39:22 +0800 Subject: [PATCH] add doc for request.cookies_str_to_dict Author: Prodesire --- docs/request.md | 14 ++++++++++++++ docs/zh-cn/request.md | 14 ++++++++++++++ 2 files changed, 28 insertions(+) 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'} +```