mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Add support for request.get's 'params' param (#770)
* Add support for request.get's 'params' param Requests defines the following API: `get(url, params=None, **kwargs)` * Improve typing for requests.get(params) Add support for string form, and tighten restrictions for the dict form to allow only string keys/vals. Technically, anything is allowed since the code (I guess) runs `str(key)` and `str(value)`, but it seems better to keep the stub somewhat strict so it can help pick up potential errors.
This commit is contained in:
committed by
Łukasz Langa
parent
43f18bc830
commit
f8717ccfc4
10
third_party/2/requests/api.pyi
vendored
10
third_party/2/requests/api.pyi
vendored
@@ -1,11 +1,17 @@
|
||||
# Stubs for requests.api (Python 3)
|
||||
|
||||
from typing import Union
|
||||
from typing import Union, Optional, AnyStr
|
||||
|
||||
from .models import Response
|
||||
|
||||
def request(method: str, url: str, **kwargs) -> Response: ...
|
||||
def get(url: Union[str, unicode], **kwargs) -> Response: ...
|
||||
|
||||
def get(url: Union[str, unicode],
|
||||
params: Optional[Union[dict[Union[str, unicode],
|
||||
Union[str, unicode]],
|
||||
Union[str, unicode]]]=None,
|
||||
**kwargs) -> Response: ...
|
||||
|
||||
def options(url: Union[str, unicode], **kwargs) -> Response: ...
|
||||
def head(url: Union[str, unicode], **kwargs) -> Response: ...
|
||||
def post(url: Union[str, unicode], data=..., json=...,
|
||||
|
||||
8
third_party/3/requests/api.pyi
vendored
8
third_party/3/requests/api.pyi
vendored
@@ -1,11 +1,15 @@
|
||||
# Stubs for requests.api (Python 3)
|
||||
|
||||
import typing
|
||||
from typing import Optional, Union, Any
|
||||
|
||||
from .models import Response
|
||||
|
||||
def request(method: str, url: str, **kwargs) -> Response: ...
|
||||
def get(url: str, **kwargs) -> Response: ...
|
||||
def get(url: Union[str, bytes],
|
||||
params: Optional[Union[str,
|
||||
bytes,
|
||||
dict[Union[str, bytes], Union[str, bytes]]]]=None,
|
||||
**kwargs) -> Response: ...
|
||||
def options(url: str, **kwargs) -> Response: ...
|
||||
def head(url: str, **kwargs) -> Response: ...
|
||||
def post(url: str, data=..., json=..., **kwargs) -> Response: ...
|
||||
|
||||
Reference in New Issue
Block a user