requests.(post|put|patch) json kwarg should be Any. (#1387)

```python
>>> requests.post('https://httpbin.org/post', json=["ham", "spam", {"eggs": "bacon"}]).json()
{'args': {}, 'data': '["ham", "spam", {"eggs": "bacon"}]', 'files': {}, 'form': {}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close', 'Content-Length': '34', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.17.3'}, 'json': ['ham', 'spam', {'eggs': 'bacon'}], 'origin': '82.70.100.78', 'url': 'https://httpbin.org/post'}
>>> requests.post('https://httpbin.org/post', json=("ham", "spam", {"eggs": "bacon"})).json()
{'args': {}, 'data': '["ham", "spam", {"eggs": "bacon"}]', 'files': {}, 'form': {}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close', 'Content-Length': '34', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.17.3'}, 'json': ['ham', 'spam', {'eggs': 'bacon'}], 'origin': '82.70.100.78', 'url': 'https://httpbin.org/post'}
```
This commit is contained in:
Thomas Grainger
2017-06-08 19:53:26 +01:00
committed by Matthias Kramm
parent 25b3a818d3
commit 55f1883928

View File

@@ -20,7 +20,7 @@ def get(url: Union[Text, bytes],
**kwargs) -> Response: ...
def options(url: Union[str, Text], **kwargs) -> Response: ...
def head(url: Union[str, Text], **kwargs) -> Response: ...
def post(url: Union[str, Text], data: _Data = ..., json: Optional[MutableMapping] = ..., **kwargs) -> Response: ...
def put(url: Union[str, Text], data: _Data = ..., **kwargs) -> Response: ...
def patch(url: Union[str, Text], data: _Data = ..., **kwargs) -> Response: ...
def post(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ...
def put(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ...
def patch(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ...
def delete(url: Union[str, Text], **kwargs) -> Response: ...