Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more types to LooseCookies #4205 #4218

Merged
merged 3 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/4218.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add two more types to LooseCookies.
2 changes: 1 addition & 1 deletion aiohttp/cookiejar.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def update_cookies(self,
return

if isinstance(cookies, Mapping):
cookies = cookies.items() # type: ignore
cookies = cookies.items()

for name, cookie in cookies:
if not isinstance(cookie, Morsel):
Expand Down
16 changes: 13 additions & 3 deletions aiohttp/typedefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
_CIMultiDictProxy = CIMultiDictProxy[str]
_MultiDict = MultiDict[str]
_MultiDictProxy = MultiDictProxy[str]
from http.cookies import BaseCookie # noqa
from http.cookies import BaseCookie, Morsel # noqa
else:
_CIMultiDict = CIMultiDict
_CIMultiDictProxy = CIMultiDictProxy
Expand All @@ -43,8 +43,18 @@
_CIMultiDictProxy]
RawHeaders = Tuple[Tuple[bytes, bytes], ...]
StrOrURL = Union[str, URL]
LooseCookies = Union[Iterable[Tuple[str, 'BaseCookie[str]']],
Mapping[str, 'BaseCookie[str]'], 'BaseCookie[str]']

StrBaseCookieTuples = Iterable[Tuple[str, 'BaseCookie[str]']]
StrMorselTuples = Iterable[Tuple[str, 'Morsel[str]']]
StrToBaseCookieMapping = Mapping[str, 'BaseCookie[str]']
StrToMorselMapping = Mapping[str, 'Morsel[Any]']
LooseCookies = Union[
StrBaseCookieTuples,
StrMorselTuples,
StrToBaseCookieMapping,
StrToMorselMapping,
'BaseCookie[str]',
]


if sys.version_info >= (3, 6):
Expand Down