Skip to content

Commit

Permalink
Try fake-useragent
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmig committed Oct 17, 2024
1 parent 01df14e commit d67de0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-e .
fake-useragent
linkify-it-py
myst-parser
nbsphinx
Expand Down
13 changes: 12 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys

import setuptools_scm
from fake_useragent import UserAgent

# Used when building API docs, put the dependencies
# of any class you are documenting here
Expand Down Expand Up @@ -174,9 +175,19 @@
# A list of regular expressions that match URIs that should not be checked
linkcheck_ignore = [
"https://pubs.acs.org/doi/*", # Checking dois is forbidden here
"https://opensource.org/license/bsd-3-clause/", # to avoid odd 403 error
# "https://opensource.org/license/bsd-3-clause/", # to avoid 403 error
]

# Generate a random User-Agent string
ua = UserAgent()
# Spoof user agent to avoid 403 errors, see
# https://github.com/sphinx-doc/sphinx/issues/10343#issuecomment-1097430133
linkcheck_request_headers = {
"https://opensource.org/license/bsd-3-clause/": {
"User-Agent": ua.random
}
}

myst_url_schemes = {
"http": None,
"https": None,
Expand Down

0 comments on commit d67de0e

Please sign in to comment.