File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 3131# https://sphinx-rtd-theme.readthedocs.io/en/stable/installing.html
3232import sphinx_rtd_theme # noqa
3333
34+
35+ def download_with_headers (url , filename ):
36+ """Download a file with proper User-Agent header to avoid 403 errors."""
37+ try :
38+ req = urllib .request .Request (
39+ url , headers = {"User-Agent" : "pyAMReX-docs-builder" }
40+ )
41+ with urllib .request .urlopen (req ) as response :
42+ with open (filename , "wb" ) as f :
43+ f .write (response .read ())
44+ except Exception as e :
45+ print (f"Could not download { filename } from { url } : { e } " )
46+ print ("Continuing build without cross-reference file..." )
47+
48+
3449# -- General configuration ------------------------------------------------
3550
3651# If your documentation needs a minimal Sphinx version, state it here.
196211highlight_language = "cpp"
197212
198213# Download AMReX Doxygen Tagfiles to interlink Doxygen docs
199- url = "https://amrex-codes.github.io/amrex/docs_xml/doxygen/amrex-doxygen-web.tag.xml"
200- urllib .request .urlretrieve (url , "../amrex-doxygen-web.tag.xml" )
214+ download_with_headers (
215+ url = "https://amrex-codes.github.io/amrex/docs_xml/doxygen/amrex-doxygen-web.tag.xml" ,
216+ filename = "../amrex-doxygen-web.tag.xml" ,
217+ )
201218
202219# Build Doxygen
203220subprocess .call (
You can’t perform that action at this time.
0 commit comments