You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using this snippet to allow a custom JSON encoder to be used (which is patching parts of python-jose):
fromjoseimportjws, jwtfromjose.utilsimportbase64url_encodefrommy_encoderimportMyEncoderdef_encode_with_my_encoder(payload):
"""Encode the payload with custom JSON encoder which knows how to handle the custom types """ifisinstance(payload, Mapping):
try:
payload=json.dumps(
payload,
separators=(',', ':'),
cls=MyEncoder
).encode('utf-8')
exceptValueError:
passreturnbase64url_encode(payload)
jws._encode_payload=_encode_with_juice_encoder
Would it be feasible to support passing in a custom encoder class into the encode method?
The text was updated successfully, but these errors were encountered:
I am using this snippet to allow a custom JSON encoder to be used (which is patching parts of python-jose):
Would it be feasible to support passing in a custom encoder class into the
encode
method?The text was updated successfully, but these errors were encountered: