cookies - python use LWPcookiejar in aiohttp session -


i have lwpcookiejar saved using python requests:

import requests import http.cookiejar s = requests.session() s.cookies = http.cookiejar.lwpcookiejar(filename="test.cookies") s.post("https://stackoverflow.com/users/login", data= <here username , password>) s.cookies.save() 

i enter directly session using aiohttp, loading saved cookie in it.

import asyncio import aiohttp async def test_urls():     async clientsession(cookie_jar=http.cookiejar.lwpcookiejar("test.cookies")) session:         async session.get("https://stackoverlow.com") response:             response = await response.text()             soup = beautifulsoup(response, 'html.parser')             print(soup.prettify())  loop = asyncio.get_event_loop() loop.run_until_complete(test_urls()) 

i receive error: attributeerror: 'lwpcookiejar' object has no attribute 'filter_cookies'

i think because i dont understand how set cookies aiohttp session.

anyone can me?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -