Downloading Files with Requests Using Selenium Webdriver Session Cookies

Python
2018-10-11 12:31 (7 years ago)
Downloading Files with Requests Using Selenium Webdriver Session Cookies

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

```python zf = zipfile.ZipFile(io.BytesIO(response.content), 'r') for filedata in zf.infolist(): if filedata.filename.endswith(xxxx): content = zf.read(filedata).decode('ascii') ```
Please rate this article
Currently unrated
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive