Downloading Files with Requests Using Selenium Webdriver Session Cookies

Python
2018-10-11 21:31 (6 years ago) ytyng

Here is the translated text of the Japanese blog article into English:

cookies = {
    cookie['name']: cookie['value']
    for cookie in driver.get_cookies()
}

response = requests.get(
    url,
    headers={'User-Agent': self.user_agent},
    cookies=cookies
)

Additional Note: Extracting zip

zf = zipfile.ZipFile(io.BytesIO(response.content), 'r')
for filedata in zf.infolist():
    if filedata.filename.endswith(xxxx):
        content = zf.read(filedata).decode('ascii')
Currently unrated

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011