Skip to content

Commit 1df20e0

Browse files
committed
WIP: curr
1 parent 79e5a8c commit 1df20e0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

jwt_proxy/api.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
from flask import Blueprint, abort, current_app, jsonify, request
1+
from flask import Blueprint, abort, current_app, jsonify, request, json as flask_json
22
import jwt
33
import requests
44
import json
5-
from json import JSONEncoder
6-
from flask.json.provider import _default as _json_default
5+
from flask.json.provider import DefaultJSONProvider
76

87
from jwt_proxy.audit import audit_HAPI_change
98

@@ -98,10 +97,14 @@ def config_settings(config_key):
9897
"""Non-secret application settings"""
9998

10099
# workaround no JSON representation for datetime.timedelta
101-
def json_default(obj):
102-
return _json_default(obj)
100+
class CustomJSONProvider(DefaultJSONProvider):
101+
def __init__(self, app):
102+
super().__init__(app)
103103

104-
current_app.json.default = json_default
104+
def default(self, o):
105+
return str(o)
106+
107+
current_app.json = CustomJSONProvider
105108

106109
# return selective keys - not all can be be viewed by users, e.g.secret key
107110
blacklist = ("SECRET", "KEY")

0 commit comments

Comments
 (0)