def encode_token(self, request, user=None, expiry=None, **token):
        if not jwt:     # pragma    nocover
            raise ImproperlyConfigured('JWT library not available')

        if expiry:
            token['exp'] = int(time.mktime(expiry.timetuple()))

        request.app.fire('on_token', request, token, user)
        return to_string(jwt.encode(token, request.config['SECRET_KEY']))
Encode a JWT
dataset/ETHPy150Open quantmind/lux/lux/extensions/rest/backends/mixins.py/TokenBackendMixin.encode_token