handle 'json' parameter in Extractor.request() manually

Mainly to allow passing custom classes like util.LazyPrompt,
but also to simplify and streamline how requests handles it.
pull/4906/head
Mike Fährmann 10 months ago
parent 9dd5cb8c8a
commit 6a4218aa23
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -136,6 +136,18 @@ class Extractor():
kwargs["timeout"] = self._timeout
if "verify" not in kwargs:
kwargs["verify"] = self._verify
if "json" in kwargs:
json = kwargs["json"]
if json is not None:
kwargs["data"] = util.json_dumps(json).encode()
del kwargs["json"]
headers = kwargs.get("headers")
if headers:
headers["Content-Type"] = "application/json"
else:
kwargs["headers"] = {"Content-Type": "application/json"}
response = None
tries = 1

Loading…
Cancel
Save