summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2020-01-07 09:56:52 +0000
committerJulian Berman <Julian@GrayVines.com>2020-01-07 10:00:58 +0000
commit5f296fdda30a640413cc5018722a78940f7f06a4 (patch)
tree71113b1432686803ced7e88c96cb92641631efa1 /docs
parent68a981289c180ab2f3ea3060eb2b1ba5aa3002b2 (diff)
downloadjsonschema-5f296fdda30a640413cc5018722a78940f7f06a4.tar.gz
Set a user agent for the Sphinx role.
Somewhat unsurprisingly GH appears to have started returning 403s for the default urllib one.
Diffstat (limited to 'docs')
-rw-r--r--docs/jsonschema_role.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/jsonschema_role.py b/docs/jsonschema_role.py
index 6f61cdb..a63ff72 100644
--- a/docs/jsonschema_role.py
+++ b/docs/jsonschema_role.py
@@ -9,10 +9,11 @@ except ImportError:
import urllib.request as urllib
import certifi
+import jsonschema
from lxml import html
-__version__ = "1.0.0"
+__version__ = "1.1.0"
VALIDATION_SPEC = "https://json-schema.org/draft-07/json-schema-validation.html"
@@ -53,7 +54,11 @@ def fetch_or_load(spec_path):
the path to a cached specification
"""
- headers = {}
+ headers = {
+ "User-Agent": "python-jsonschema v{} - documentation build v{}".format(
+ jsonschema.__version__, __version__,
+ ),
+ }
try:
modified = datetime.utcfromtimestamp(os.path.getmtime(spec_path))