Skip to content

Commit

Permalink
[Improvement] add default user-agent header in webpage loader (#1219)
Browse files Browse the repository at this point in the history
  • Loading branch information
deven298 authored Jan 26, 2024
1 parent 433f99d commit b210723
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion embedchain/loaders/web_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class WebPageLoader(BaseLoader):

def load_data(self, url):
"""Load data from a web page using a shared requests' session."""
response = self._session.get(url, timeout=30)
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36", # noqa:E501
}
response = self._session.get(url, headers=headers, timeout=30)
response.raise_for_status()
data = response.content
content = self._get_clean_content(data, url)
Expand Down

0 comments on commit b210723

Please sign in to comment.