Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions openbadges/verifier/tasks/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def fetch_http_node(state, task_meta, **options):
)

try:
json.loads(result.text)
json_body = result.json()
response_text_with_proper_encoding = json.dumps(json_body)
except ValueError:
content_type = result.headers.get('Content-Type', 'UNKNOWN')

Expand All @@ -65,8 +66,8 @@ def fetch_http_node(state, task_meta, **options):
True, 'Successfully fetched image from {}'.format(url), actions)

actions = [
store_original_resource(node_id=url, data=result.text),
add_task(INTAKE_JSON, data=result.text, node_id=url,
store_original_resource(node_id=url, data=response_text_with_proper_encoding),
add_task(INTAKE_JSON, data=response_text_with_proper_encoding, node_id=url,
expected_class=task_meta.get('expected_class'),
source_node_path=task_meta.get('source_node_path'))]
return task_result(message="Successfully fetched JSON data from {}".format(url), actions=actions)
Expand Down