Skip to content

Commit 5f296fd

Browse files
committed
Set a user agent for the Sphinx role.
Somewhat unsurprisingly GH appears to have started returning 403s for the default urllib one.
1 parent 68a9812 commit 5f296fd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/jsonschema_role.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
import urllib.request as urllib
1010

1111
import certifi
12+
import jsonschema
1213
from lxml import html
1314

1415

15-
__version__ = "1.0.0"
16+
__version__ = "1.1.0"
1617
VALIDATION_SPEC = "https://json-schema.org/draft-07/json-schema-validation.html"
1718

1819

@@ -53,7 +54,11 @@ def fetch_or_load(spec_path):
5354
the path to a cached specification
5455
"""
5556

56-
headers = {}
57+
headers = {
58+
"User-Agent": "python-jsonschema v{} - documentation build v{}".format(
59+
jsonschema.__version__, __version__,
60+
),
61+
}
5762

5863
try:
5964
modified = datetime.utcfromtimestamp(os.path.getmtime(spec_path))

0 commit comments

Comments
 (0)