mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-08 17:29:34 +08:00
relocate kwargs preparation
This commit is contained in:
@@ -43,6 +43,13 @@ def prepare_kwargs(method, kwargs):
|
||||
if charset:
|
||||
kwargs["data"] = kwargs["data"].encode(charset)
|
||||
|
||||
if "httpntlmauth" in kwargs:
|
||||
from requests_ntlm import HttpNtlmAuth
|
||||
auth_account = kwargs.pop("httpntlmauth")
|
||||
kwargs["auth"] = HttpNtlmAuth(
|
||||
auth_account["username"], auth_account["password"])
|
||||
|
||||
|
||||
class ApiResponse(Response):
|
||||
|
||||
def raise_for_status(self):
|
||||
@@ -127,12 +134,6 @@ class HttpSession(requests.Session):
|
||||
# set up pre_request hook for attaching meta data to the request object
|
||||
self.meta_data["method"] = method
|
||||
|
||||
if "httpntlmauth" in kwargs:
|
||||
from requests_ntlm import HttpNtlmAuth
|
||||
auth_account = kwargs.pop("httpntlmauth")
|
||||
kwargs["auth"] = HttpNtlmAuth(
|
||||
auth_account["username"], auth_account["password"])
|
||||
|
||||
kwargs.setdefault("timeout", 120)
|
||||
|
||||
self.meta_data["request_time"] = time.time()
|
||||
|
||||
Reference in New Issue
Block a user