Skip to content

Commit

Permalink
community[patch]: Add Cookie Support to Fetch Method (#16673)
Browse files Browse the repository at this point in the history
- **Description:** This change allows the `_fetch` method in the
`WebBaseLoader` class to utilize cookies from an existing
`requests.Session`. It ensures that when the `fetch` method is used, any
cookies in the provided session are included in the request. This
enhancement maintains compatibility with existing functionality while
extending the utility of the `fetch` method for scenarios where cookie
persistence is necessary.
- **Issue:** Not applicable (new feature),
- **Dependencies:** Requires `aiohttp` and `requests` libraries (no new
dependencies introduced),
- **Twitter handle:** N/A

Co-authored-by: Joao Almeida <[email protected]>
  • Loading branch information
Jalmeida1994 and Joao Almeida authored Jan 28, 2024
1 parent c314137 commit 3e87b67
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ async def _fetch(
url,
headers=self.session.headers,
ssl=None if self.session.verify else False,
cookies=self.session.cookies.get_dict(),
) as response:
return await response.text()
except aiohttp.ClientConnectionError as e:
Expand Down

0 comments on commit 3e87b67

Please sign in to comment.