-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Long story short
Using CookieJar.filter_cookies() does not preserve the expiration date of the returned cookies.
Expected behaviour
Return the full cookie Morsels that have the expires, domain, path, etc. fields.
Actual behaviour
The expires field is not included in the cookie Morsels returned from CookieJar.filter_cookies().
Steps to reproduce
Here's a full working example to demonstrate. It's a contrived example, but it gets the point across. Iterating through cookie_jar gives me the full Morsel objects with expiration. But iterating through filtered_cookies does not contain the expiration.
from http.cookies import SimpleCookie
import yarl
from aiohttp import CookieJar
cookies = SimpleCookie()
cookies.load('browser_session=secret; Domain=.test.com; Path=/; Expires=Tue, 30-Jul-69 14:47:41 GMT; HttpOnly')
cookie_jar = CookieJar()
cookie_jar.update_cookies(cookies)
for cookie in cookie_jar:
print(f'{cookie.value!r} expires {cookie["expires"]!r}')
url = yarl.URL('http://www.test.com')
filtered_cookies = cookie_jar.filter_cookies(url)
for _, cookie in filtered_cookies.items():
print(f'{cookie.value!r} expires {cookie["expires"]!r}')Your environment
I'm using the latest stable release of aiohttp (3.5.4).
Reactions are currently unavailable