---
slug: "selenium-webdriver-session-cookie-requests"
title: "Downloading Files with Requests Using Selenium Webdriver Session Cookies"
description: "Pass a logged-in session cookie from Selenium WebDriver into `requests` to download files that require a browser-bound session."
url: "https://www.ytyng.com/en/blog/selenium-webdriver-session-cookie-requests"
publish_date: "2018-10-11T12:31:14Z"
created: "2018-10-11T12:31:14Z"
updated: "2026-05-11T13:13:59.744Z"
categories: ["Python"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/415eadf6fc4c4c97a865093994392b55.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Downloading Files with Requests Using Selenium Webdriver Session Cookies

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

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

response = requests.get(
    url,
    headers={'User-Agent': self.user_agent},
    cookies=cookies
)
```
<p>Additional Note: Extracting zip</p>
```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')
```

