Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions import-automation/executor/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ beautifulsoup4
chardet
chromedriver_py
croniter
curl_cffi
dataclasses
datacommons
datacommons_client
Expand Down
4 changes: 2 additions & 2 deletions statvar_imports/us_bls/cpi_category/cpi_category_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'''


import requests
from curl_cffi import requests
import os
import zipfile
import re
Expand Down Expand Up @@ -64,7 +64,7 @@ def download_file(url: str, save_path: str ,timeout: int = 60):
}
try:
logging.info(f"Attempting to download: {url} with timeout {timeout} seconds.")
response = requests.get(url, stream=True, headers=headers, timeout=timeout)
response = requests.get(url, stream=True, headers=headers, timeout=timeout, impersonate="chrome124") # To avoid 403 errors, we use impersonate to mimic a real browser's TLS fingerprint.
response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)

# Ensure the directory for save_path exists
Expand Down
Loading