From fb898a6d877452b40700ab3efd3b0ec379e8d617 Mon Sep 17 00:00:00 2001 From: jeroenlicht Date: Sun, 1 Sep 2019 16:48:22 +0200 Subject: [PATCH] Update graph.py Many websites are configured to block requests with a missing User-Agent For me this was causing an error for FETCH_HTTP_NODE on validating my assertion json url: "Unknown Content-Type (Not image/png or image/svg+xml)" It was solved after adding 'User-Agent': 'Open Badges Validator Core' to the headers on line 40 of verifier/tasks/graph.py --- openbadges/verifier/tasks/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbadges/verifier/tasks/graph.py b/openbadges/verifier/tasks/graph.py index b525086..36da282 100644 --- a/openbadges/verifier/tasks/graph.py +++ b/openbadges/verifier/tasks/graph.py @@ -37,7 +37,7 @@ def fetch_http_node(state, task_meta, **options): session = requests.Session() result = session.get( - url, headers={'Accept': 'application/ld+json, application/json, image/png, image/svg+xml'} + url, headers={'User-Agent': 'Open Badges Validator Core', 'Accept': 'application/ld+json, application/json, image/png, image/svg+xml'} ) try: