當前位置: 首頁>>代碼示例>>Python>>正文


Python PreparedRequest.method方法代碼示例

本文整理匯總了Python中requests.models.PreparedRequest.method方法的典型用法代碼示例。如果您正苦於以下問題:Python PreparedRequest.method方法的具體用法?Python PreparedRequest.method怎麽用?Python PreparedRequest.method使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在requests.models.PreparedRequest的用法示例。


在下文中一共展示了PreparedRequest.method方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: deserialize_prepared_request

# 需要導入模塊: from requests.models import PreparedRequest [as 別名]
# 或者: from requests.models.PreparedRequest import method [as 別名]
def deserialize_prepared_request(serialized):
    p = PreparedRequest()
    p.body = serialized['body']
    p.headers = CaseInsensitiveDict(serialized['headers'])
    p.method = serialized['method']
    p.url = serialized['uri']
    return p
開發者ID:pombredanne,項目名稱:betamax,代碼行數:9,代碼來源:cassette.py

示例2: copy_request

# 需要導入模塊: from requests.models import PreparedRequest [as 別名]
# 或者: from requests.models.PreparedRequest import method [as 別名]
def copy_request(request):
    """Copy a Requests PreparedRequest."""
    new_request = PreparedRequest()

    new_request.method = request.method
    new_request.url = request.url
    new_request.body = request.body
    new_request.hooks = request.hooks
    new_request.headers = request.headers.copy()

    return new_request
開發者ID:mdengler,項目名稱:requests-ntlm,代碼行數:13,代碼來源:requests_ntlm.py

示例3: deserialize_prepared_request

# 需要導入模塊: from requests.models import PreparedRequest [as 別名]
# 或者: from requests.models.PreparedRequest import method [as 別名]
def deserialize_prepared_request(serialized):
    p = PreparedRequest()
    p._cookies = RequestsCookieJar()
    body = serialized['body']
    if isinstance(body, dict):
        original_body = body.get('string')
        p.body = original_body or base64.b64decode(
            body.get('base64_string', '').encode())
    else:
        p.body = body
    h = [(k, from_list(v)) for k, v in serialized['headers'].items()]
    p.headers = CaseInsensitiveDict(h)
    p.method = serialized['method']
    p.url = serialized['uri']
    return p
開發者ID:bboe,項目名稱:betamax,代碼行數:17,代碼來源:util.py


注:本文中的requests.models.PreparedRequest.method方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。