Skip to content

Commit 55f1883

Browse files
graingertmatthiaskramm
authored andcommitted
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'} ```
1 parent 25b3a81 commit 55f1883

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

third_party/2and3/requests/api.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def get(url: Union[Text, bytes],
2020
**kwargs) -> Response: ...
2121
def options(url: Union[str, Text], **kwargs) -> Response: ...
2222
def head(url: Union[str, Text], **kwargs) -> Response: ...
23-
def post(url: Union[str, Text], data: _Data = ..., json: Optional[MutableMapping] = ..., **kwargs) -> Response: ...
24-
def put(url: Union[str, Text], data: _Data = ..., **kwargs) -> Response: ...
25-
def patch(url: Union[str, Text], data: _Data = ..., **kwargs) -> Response: ...
23+
def post(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ...
24+
def put(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ...
25+
def patch(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ...
2626
def delete(url: Union[str, Text], **kwargs) -> Response: ...

0 commit comments

Comments
 (0)