Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Object of type 'UUID' is not JSON serializable when url param is of type uuid #98

Open
krzysztofkusmierczyk opened this issue Dec 11, 2018 · 0 comments

Comments

@krzysztofkusmierczyk
Copy link

krzysztofkusmierczyk commented Dec 11, 2018

flask-profiler raises an exception when calling an endpoint with uuid parameter like /game/<uuid:game_id>/status

Windows 10 if it matters.

  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask_profiler\flask_profiler.py", line 137, in wrapper
    return wrapped(*args, **kwargs)
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask_profiler\flask_profiler.py", line 116, in wrapper
    collection.insert(measurement.__json__())
  File "C:\Users\krzys\.virtualenvs\xxx\lib\site-packages\flask_profiler\storage\sql_alchemy.py", line 69, in insert
    kwargs = json.dumps(kwds.get('kwargs', ()))
  File "C:\Program Files (x86)\Python36-32\Lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "C:\Program Files (x86)\Python36-32\Lib\json\encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "C:\Program Files (x86)\Python36-32\Lib\json\encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "C:\Program Files (x86)\Python36-32\Lib\json\encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'UUID' is not JSON serializable```
krzysztofkusmierczyk added a commit to krzysztofkusmierczyk/flask-profiler that referenced this issue Jan 30, 2019
krzysztofkusmierczyk added a commit to krzysztofkusmierczyk/flask-profiler that referenced this issue Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant