本文整理匯總了Python中requests.models.PreparedRequest.copy方法的典型用法代碼示例。如果您正苦於以下問題:Python PreparedRequest.copy方法的具體用法?Python PreparedRequest.copy怎麽用?Python PreparedRequest.copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類requests.models.PreparedRequest
的用法示例。
在下文中一共展示了PreparedRequest.copy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_prepared_copy
# 需要導入模塊: from requests.models import PreparedRequest [as 別名]
# 或者: from requests.models.PreparedRequest import copy [as 別名]
def test_prepared_copy(kwargs):
p = PreparedRequest()
if kwargs:
p.prepare(**kwargs)
copy = p.copy()
for attr in ('method', 'url', 'headers', '_cookies', 'body', 'hooks'):
assert getattr(p, attr) == getattr(copy, attr)
示例2: test_prepared_request_no_cookies_copy
# 需要導入模塊: from requests.models import PreparedRequest [as 別名]
# 或者: from requests.models.PreparedRequest import copy [as 別名]
def test_prepared_request_no_cookies_copy():
p = PreparedRequest()
p.prepare(
method='GET',
url='http://www.example.com',
data='foo=bar',
hooks=default_hooks()
)
assert_copy(p, p.copy())
示例3: test_prepared_request_complete_copy
# 需要導入模塊: from requests.models import PreparedRequest [as 別名]
# 或者: from requests.models.PreparedRequest import copy [as 別名]
def test_prepared_request_complete_copy():
p = PreparedRequest()
p.prepare(method="GET", url="http://www.example.com", data="foo=bar", hooks=default_hooks(), cookies={"foo": "bar"})
assert_copy(p, p.copy())
示例4: test_prepared_request_empty_copy
# 需要導入模塊: from requests.models import PreparedRequest [as 別名]
# 或者: from requests.models.PreparedRequest import copy [as 別名]
def test_prepared_request_empty_copy():
p = PreparedRequest()
assert_copy(p, p.copy())