代码片段库

经过测试、可直接复制的 Python、Flask、JavaScript、SQL、HTML、CSS 和 Bash 代码片段,都可以在代码游乐场中打开。

2 个代码片段

python

Retry a flaky call with exponential backoff

A decorator that retries a function on chosen exceptions, waiting longer after each failure.

intermediate #retry#decorators#network
flask

Login-required decorator for JSON routes

Answer 401 JSON instead of redirecting to the login page.

intermediate #auth#decorators#api