Skip to content

Commit

Permalink
Merge pull request #341 from coderxio/jrlegrand/fix-fda-headers
Browse files Browse the repository at this point in the history
Add headers to requests
  • Loading branch information
jrlegrand authored Jan 15, 2025
2 parents 6b857e7 + 7b3273d commit 5c1a981
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion airflow/dags/sagerx.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ def download_dataset(url: str, dest: Path = Path.cwd(), file_name: str = None):
import requests
import re

with requests.get(url, stream=True, allow_redirects=True) as r:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
}

with requests.get(url, stream=True, allow_redirects=True, headers=headers) as r:
r.raise_for_status()

if file_name == None:
Expand Down

0 comments on commit 5c1a981

Please sign in to comment.