{
  "id": "task_libraries:rate-limiting/python",
  "path": "/exapedia/python-rate-limiting-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python rate limiting libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python rate limiting libraries cap how many requests a client can make in a time window or how fast a program sends outgoing calls. A limiter counts hits per key under a strategy such as a fixed window or a leaky bucket. These libraries let web APIs and AI agents stay within a set request budget."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python rate limiting libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#limits",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F130"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F134"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#djangorestframework",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F145"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#slowapi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F163"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F35"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#aiolimiter",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#ratelimit",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F196"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F197"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F200"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyratelimiter",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F213"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F214"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F58"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F217"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F215"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#flask-limiter-library",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F228"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F232"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#django-axes",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F245"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F246"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F249"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "PyPI"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#limits",
          "label": [
            {
              "t": "text",
              "text": "limits"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F131"
        },
        {
          "t": "text",
          "text": ", a count that includes installs through Flask-Limiter and SlowAPI."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "External shared quota state",
            "Waits for quota"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#limits",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F130"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F137"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#djangorestframework",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F145"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F154"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#slowapi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F163"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F171"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#aiolimiter",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F187"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#ratelimit",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F196"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F206"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyratelimiter",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F213"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#flask-limiter-library",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F228"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F237"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F238"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#django-axes",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F245"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F254"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F255"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "limits",
          "name": [
            {
              "t": "fact",
              "fact": "F130"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/alisaifee/limits"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/limits"
            },
            {
              "label": "Docs",
              "href": "https://limits.readthedocs.io/en/stable/api.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F12"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://limits.readthedocs.io/en/stable/api.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F130"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/alisaifee/flask-limiter",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F143"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def __evaluate_limits(self, endpoint: str, limits: list[RuntimeLimit]) -> None:\n    failed_limits: list[tuple[RuntimeLimit, list[str]]] = []\n    limit_for_header: RequestLimit | None = None\n    view_limits: list[RequestLimit] = []\n    meta_limits = [\n        meta_limit\n        for meta_limit in itertools.chain(\n            *self._meta_limits,\n            *[limit.meta_limits for limit in limits if limit.meta_limits],\n        )\n        if not meta_limit.is_exempt\n    ]\n    if not (\n        ExemptionScope.META\n        & self.limit_manager.exemption_scope(\n            flask.current_app, endpoint, flask.request.blueprint\n        )\n    ):\n        for lim in meta_limits:\n            limit_key, scope = lim.key_func(), lim.scope_for(endpoint, None)\n            args = [limit_key, scope]\n            on_breach = lim.on_breach or self._on_meta_breach\n            if not self.limiter.test(lim.limit, *args, cost=lim.deduction_amount):\n                breached_meta_limit = RequestLimit(self, lim.limit, args, True, lim.shared)\n                self.context.view_rate_limit = breached_meta_limit\n                self.context.view_rate_limits = [breached_meta_limit]\n                meta_breach_response = None\n\n                if on_breach:\n                    try:\n                        cb_response = on_breach(breached_meta_limit)\n\n                        if isinstance(cb_response, flask.wrappers.Response):\n                            meta_breach_response = cb_response\n                    except Exception as err:  # noqa\n                        if self._swallow_errors:\n                            self.logger.exception(\n                                \"on_meta_breach callback failed with error %s\", err\n                            )\n                        else:\n                            raise err\n                raise RateLimitExceeded(lim, response=meta_breach_response)\n\n    for lim in sorted(limits, key=lambda x: x.limit):\n        if lim.is_exempt or lim.method_exempt:\n            continue\n\n        limit_scope = lim.scope_for(endpoint, flask.request.method)\n        limit_key = lim.key_func()\n        args = [limit_key, limit_scope]\n        kwargs = {}\n\n        if not all(args):\n            self.logger.error(f\"Skipping limit: {lim.limit}. Empty value found in parameters.\")\n\n            continue\n\n        if self._key_prefix:\n            args = [self._key_prefix, *args]\n\n        if lim.deduct_when:\n            self.context.conditional_deductions[lim] = args\n            method = self.limiter.test\n        else:\n            method = self.limiter.hit\n        kwargs[\"cost\"] = lim.deduction_amount\n\n        request_limit = RequestLimit(self, lim.limit, args, False, lim.shared)\n        view_limits.append(request_limit)\n\n        if not method(lim.limit, *args, **kwargs):\n            self.logger.info(\n                \"ratelimit %s (%s) exceeded at endpoint: %s\",\n                lim.limit,\n                limit_key,\n                limit_scope,\n            )\n            failed_limits.append((lim, args))\n            view_limits[-1].breached = True\n            limit_for_header = view_limits[-1]\n\n            if self._fail_on_first_breach:\n                break\n\n    if not limit_for_header and view_limits:\n        # Pick a non shared limit over a shared one if possible\n        # when no rate limit has been hit. This should be the best hint\n        # for the client.\n        explicit = [limit for limit in view_limits if not limit.shared]\n        limit_for_header = explicit[0] if explicit else view_limits[0]\n\n    self.context.view_rate_limit = limit_for_header or None\n    self.context.view_rate_limits = view_limits\n\n    on_breach_response = None\n\n    for limit in failed_limits:\n        request_limit = RequestLimit(self, limit[0].limit, limit[1], True, limit[0].shared)\n\n        for cb in dict.fromkeys([self._on_breach, limit[0].on_breach]):\n            if cb:\n                try:\n                    cb_response = cb(request_limit)\n\n                    if isinstance(cb_response, flask.wrappers.Response):\n                        on_breach_response = cb_response\n                except Exception as err:  # noqa\n                    if self._swallow_errors:\n                        self.logger.exception(\"on_breach callback failed with error %s\", err)\n                    else:\n                        raise err\n\n    if failed_limits:\n        meta_limits = [\n            meta_limit\n            for meta_limit in itertools.chain(\n                *self._meta_limits,\n                *[list(lim[0].meta_limits) for lim in failed_limits if lim[0].meta_limits],\n            )\n            if not meta_limit.is_exempt\n        ]\n        for lim in meta_limits:\n            limit_scope = lim.scope_for(endpoint, flask.request.method)\n            limit_key = lim.key_func()\n            args = [limit_key, limit_scope]\n            self.limiter.hit(lim.limit, *args)\n        raise RateLimitExceeded(\n            sorted(failed_limits, key=lambda x: x[0].limit)[0][0],\n            response=on_breach_response,\n        )",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/alisaifee/flask-limiter/blob/0e715b6fbb4655756f747c78d95d61deaa69dd1c/flask_limiter/_extension.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F142"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20limits%20for%20rate-limit%20strategy%20integration%2C%20request%20costs%2C%20quota%20checks%2C%20per-view%20policy%20configuration%20and%20throttled%20HTTP%20clients&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F130"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from limits import parse\nfrom limits.storage import MemoryStorage\nfrom limits.strategies import MovingWindowRateLimiter\n\nlimiter = MovingWindowRateLimiter(MemoryStorage())\nrate = parse(\"1/minute\")\nprint(limiter.hit(rate, \"example\"))",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://limits.readthedocs.io/en/stable/api.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F135"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "djangorestframework",
          "name": [
            {
              "t": "fact",
              "fact": "F145"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/encode/django-rest-framework"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/djangorestframework"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/encode/django-rest-framework/contents/rest_framework/throttling.py?ref=3.18.3"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F152"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/encode/django-rest-framework/contents/rest_framework/throttling.py?ref=3.18.3",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F145"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F161"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/suitenumerique/meet",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F161"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def get_cache_key(self, request, view):\n    \"\"\"Use the authenticated user ID as the throttle cache key.\"\"\"\n\n    if request.user and not request.user.is_authenticated:\n        return None  # Defer to RequestEntryAnonRateThrottle for anonymous users.\n\n    return super().get_cache_key(request, view)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/suitenumerique/meet/blob/043875e804891df523a5359ad8363d2e58138520/src/backend/core/api/throttling.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F160"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=djangorestframework%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F145"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from django.contrib.auth.models import AnonymousUser\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.throttling import UserRateThrottle\n\nclass ExampleThrottle(UserRateThrottle):\n    rate = \"2/minute\"\n\nrequest = APIRequestFactory().get(\"/\")\nrequest.user = AnonymousUser()\nprint(ExampleThrottle().allow_request(request, view=None))",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/encode/django-rest-framework/contents/rest_framework/throttling.py?ref=3.18.3",
                  "label": [
                    {
                      "t": "text",
                      "text": "throttling.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F150"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "slowapi",
          "name": [
            {
              "t": "fact",
              "fact": "F163"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/laurentS/slowapi"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/slowapi"
            },
            {
              "label": "Docs",
              "href": "https://slowapi.readthedocs.io/en/latest/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F41"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F35"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://slowapi.readthedocs.io/en/latest/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F163"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F45"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F46"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F47"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F48"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F49"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F50"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F51"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F176"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/mlflow/mlflow",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _get_endpoint_handler(gateway_api: GatewayAPI, name: str, limiter: Limiter, key: str):\n    endpoint_type_to_factory = {\n        EndpointType.LLM_V1_CHAT: _create_chat_endpoint,\n        EndpointType.LLM_V1_COMPLETIONS: _create_completions_endpoint,\n        EndpointType.LLM_V1_EMBEDDINGS: _create_embeddings_endpoint,\n    }\n    provider, endpoint_type = gateway_api._get_provider_by_name(name)\n\n    if factory := endpoint_type_to_factory.get(endpoint_type):\n        handler = factory(provider)\n\n        if name in gateway_api.dynamic_endpoints:\n            limit = gateway_api.dynamic_endpoints[name].limit\n        else:\n            limit = None\n\n        if limit:\n            limit_value = f\"{limit.calls}/{limit.renewal_period}\"\n            handler.__name__ = f\"{handler.__name__}_{name}_{key}\"\n            return limiter.limit(limit_value)(handler)\n        else:\n            return handler\n\n    raise HTTPException(\n        status_code=404,\n        detail=f\"Unexpected route type {endpoint_type!r} for route {name!r}.\",\n    )",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/mlflow/mlflow/blob/04ad38e48d55520422a53d1f23c963f6b68a2999/mlflow/gateway/app.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F175"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20slowapi%20for%20rate-limit%20strategy%20integration%2C%20request%20costs%2C%20quota%20checks%2C%20per-view%20policy%20configuration%20and%20throttled%20HTTP%20clients&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F163"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from starlette.applications import Starlette\nfrom starlette.requests import Request\nfrom starlette.responses import PlainTextResponse\nfrom slowapi import Limiter, _rate_limit_exceeded_handler\nfrom slowapi.errors import RateLimitExceeded\nfrom slowapi.util import get_remote_address\n\nlimiter = Limiter(key_func=get_remote_address)\napp = Starlette()\napp.state.limiter = limiter\napp.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)\n\n@limiter.limit(\"5/minute\")\nasync def homepage(request: Request):\n    return PlainTextResponse(\"test\")\n\napp.add_route(\"/home\", homepage)",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://slowapi.readthedocs.io/en/latest/",
                  "label": [
                    {
                      "t": "text",
                      "text": "index.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F168"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "aiolimiter",
          "name": [
            {
              "t": "fact",
              "fact": "F178"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/mjpieters/aiolimiter"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/aiolimiter"
            },
            {
              "label": "Docs",
              "href": "https://aiolimiter.readthedocs.io/en/latest/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F185"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://aiolimiter.readthedocs.io/en/latest/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F178"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/python-telegram-bot/python-telegram-bot",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F194"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "async def _run_request(\n    self,\n    chat: bool,\n    group: str | int | bool,\n    allow_paid_broadcast: bool,\n    callback: Callable[..., Coroutine[Any, Any, bool | JSONDict | list[JSONDict]]],\n    args: Any,\n    kwargs: dict[str, Any],\n) -> bool | JSONDict | list[JSONDict]:\n    async def inner() -> bool | JSONDict | list[JSONDict]:\n        # In case a retry_after was hit, we wait with processing the request\n        await self._retry_after_event.wait()\n        return await callback(*args, **kwargs)\n\n    if allow_paid_broadcast:\n        async with self._apb_limiter:\n            return await inner()\n    else:\n        base_context = self._base_limiter if (chat and self._base_limiter) else null_context()\n        group_context = (\n            self._get_group_limiter(group)\n            if group and self._group_max_rate\n            else null_context()\n        )\n\n        async with group_context, base_context:\n            return await inner()",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/python-telegram-bot/python-telegram-bot/blob/41e3633bd1b4e51693ee57059828a59a9773618a/src/telegram/ext/_aioratelimiter.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F193"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=aiolimiter%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F178"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import asyncio\nfrom aiolimiter import AsyncLimiter\n\nasync def main():\n    limiter = AsyncLimiter(100)\n    async with limiter:\n        print(\"permit acquired\")\n\nasyncio.run(main())",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://aiolimiter.readthedocs.io/en/latest/",
                  "label": [
                    {
                      "t": "text",
                      "text": "index.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F183"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "ratelimit",
          "name": [
            {
              "t": "fact",
              "fact": "F196"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/tomasbasham/ratelimit"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/ratelimit"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/ratelimit/2.2.1/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F203"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F197"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F199"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/ratelimit/2.2.1/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F196"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/datahub-project/datahub",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F211"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def get_rate_limited_emit_mcp(self, emitter: DataHubGraph) -> Any:\n    \"\"\"\n    Returns a rate limited emitter that can be used to emit metadata for propagation\n    \"\"\"\n\n    @sleep_and_retry\n    @limits(\n        calls=self.rate_limit_propagated_writes,\n        period=self.rate_limit_propagated_writes_period,\n    )\n    @wraps(emitter.emit_mcp)\n    def wrapper(*args, **kwargs):\n        return emitter.emit_mcp(*args, **kwargs)\n\n    return wrapper",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/datahub-project/datahub/blob/7d863576bcfac99d375485ca7e5b193b4f74b0df/datahub-actions/src/datahub_actions/plugin/action/propagation/propagation_utils.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F210"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=ratelimit%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F196"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from ratelimit import limits\n\n@limits(calls=1, period=1)\ndef example():\n    return \"permitted\"\n\nprint(example())",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/ratelimit/2.2.1/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F201"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pyratelimiter",
          "name": [
            {
              "t": "fact",
              "fact": "F213"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/vutran1710/PyrateLimiter"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/pyrate-limiter"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/pyrate-limiter/4.5.1/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F64"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F214"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F58"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F216"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F215"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/pyrate-limiter/4.5.1/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F213"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F69"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F70"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F226"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F227"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/schemathesis/schemathesis",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F226"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def build_limiter(rate: str) -> Limiter:\n    from pyrate_limiter import Limiter, Rate\n\n    limit, interval = parse_units(rate)\n    return Limiter(Rate(limit, interval))",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/schemathesis/schemathesis/blob/abb39fb00448208eeeb9aaa865218091becdfc6a/src/schemathesis/core/rate_limit.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F225"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pyrate-limiter%20for%20rate-limit%20strategy%20integration%2C%20request%20costs%2C%20quota%20checks%2C%20per-view%20policy%20configuration%20and%20throttled%20HTTP%20clients&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F213"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from pyrate_limiter import Duration, Rate, Limiter\n\nlimiter = Limiter(Rate(5, Duration.SECOND * 2))\nprint(limiter.try_acquire(\"my-resource\"))",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/pyrate-limiter/4.5.1/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F218"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "flask-limiter-library",
          "name": [
            {
              "t": "fact",
              "fact": "F228"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/alisaifee/flask-limiter"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/flask-limiter"
            },
            {
              "label": "Docs",
              "href": "https://flask-limiter.readthedocs.io/en/stable/api.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F235"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F231"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://flask-limiter.readthedocs.io/en/stable/api.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F228"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F243"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F244"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/dpgaspar/Flask-AppBuilder",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F243"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def create_limiter(self, app: Flask) -> Limiter:\n    limiter = Limiter(\n        key_func=app.config.get(\"RATELIMIT_KEY_FUNC\", get_remote_address)\n    )\n    limiter.init_app(app)\n    return limiter",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/dpgaspar/Flask-AppBuilder/blob/30e13dc7916167fa159452322aa00d03999970f9/flask_appbuilder/security/manager.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F242"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=flask-limiter%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F228"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from flask import Flask\nfrom flask_limiter import Limiter\nfrom flask_limiter.util import get_remote_address\n\napp = Flask(__name__)\nlimiter = Limiter(get_remote_address, app=app)\n\n@app.get(\"/\")\n@limiter.limit(\"5/minute\")\ndef index():\n    return \"permitted\"",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://flask-limiter.readthedocs.io/en/stable/api.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "api.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F233"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "django-axes",
          "name": [
            {
              "t": "fact",
              "fact": "F245"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/django-commons/django-axes"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/django-axes"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/django-commons/django-axes/contents/axes/handlers/proxy.py?ref=9.0.0"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F252"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F246"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F248"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/django-commons/django-axes/contents/axes/handlers/proxy.py?ref=9.0.0",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F245"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F261"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F262"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/babybuddy/babybuddy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F261"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def post(self, request, *args, **kwargs):\n    user = self.get_object()\n    form = self.get_form()\n    if form.is_valid():\n        reset(username=user.username)\n        return self.form_valid(form)\n    else:\n        return self.form_invalid(form)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/babybuddy/babybuddy/blob/1638cfb02e2681c5a0c2f24fdf8d20048fda995a/babybuddy/views.py",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F260"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=django-axes%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F245"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from django.test import RequestFactory\nfrom axes.handlers.proxy import AxesProxyHandler\n\nrequest = RequestFactory().post(\"/login/\")\nprint(AxesProxyHandler.is_allowed(request, {\"username\": \"example\"}))",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/django-commons/django-axes/contents/axes/handlers/proxy.py?ref=9.0.0",
                  "label": [
                    {
                      "t": "text",
                      "text": "proxy.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F250"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python rate limiting library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#limits",
          "label": [
            {
              "t": "text",
              "text": "limits"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits code that needs rate-limiting strategies over Redis, Memcached, or MongoDB storage. "
        },
        {
          "t": "link",
          "href": "#slowapi",
          "label": [
            {
              "t": "text",
              "text": "SlowAPI"
            }
          ]
        },
        {
          "t": "text",
          "text": " and "
        },
        {
          "t": "link",
          "href": "#flask-limiter-library",
          "label": [
            {
              "t": "text",
              "text": "Flask-Limiter"
            }
          ]
        },
        {
          "t": "text",
          "text": " suit FastAPI, Starlette, and Flask routes. "
        },
        {
          "t": "link",
          "href": "#aiolimiter",
          "label": [
            {
              "t": "text",
              "text": "aiolimiter"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits asyncio code that needs a leaky bucket limiter."
        }
      ]
    },
    {
      "q": "What is SlowAPI?",
      "a": [
        {
          "t": "link",
          "href": "#slowapi",
          "label": [
            {
              "t": "text",
              "text": "SlowAPI"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a rate limiting library for Starlette and FastAPI, adapted from Flask-Limiter. It tracks limits in Redis, Memcached, or memory."
        }
      ]
    },
    {
      "q": "How do I rate limit FastAPI endpoints?",
      "a": [
        {
          "t": "link",
          "href": "#slowapi",
          "label": [
            {
              "t": "text",
              "text": "SlowAPI"
            }
          ]
        },
        {
          "t": "text",
          "text": " applies a limit decorator to each endpoint function. The route decorator must sit above the limit decorator. Each limited endpoint also takes the request as an explicit argument."
        }
      ]
    },
    {
      "q": "What is aiolimiter?",
      "a": [
        {
          "t": "link",
          "href": "#aiolimiter",
          "label": [
            {
              "t": "text",
              "text": "aiolimiter"
            }
          ]
        },
        {
          "t": "text",
          "text": " is an asyncio rate limiter built on the leaky bucket algorithm."
        }
      ]
    },
    {
      "q": "What is Flask-Limiter?",
      "a": [
        {
          "t": "link",
          "href": "#flask-limiter-library",
          "label": [
            {
              "t": "text",
              "text": "Flask-Limiter"
            }
          ]
        },
        {
          "t": "text",
          "text": " adds rate limiting to Flask applications."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, limits",
      "display": "limits",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, limits",
      "display": "41.6M",
      "asOf": "2026-11-16"
    },
    "F3": {
      "label": "License, limits",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, limits",
      "display": "5.8.0, Feb 2026",
      "asOf": "2026-02-05"
    },
    "F5": {
      "label": "Package release date, limits",
      "display": "Feb 2026",
      "asOf": "2026-02-05"
    },
    "F6": {
      "label": "Repository stars, limits",
      "display": "657",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Uses Redis storage, limits",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Uses memory storage, limits",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Charges request costs, limits",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Supports async functions, limits",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "Install, limits",
      "display": "pip install limits",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "What it does, limits",
      "display": "Provides rate-limiting strategies with interchangeable storage backends.",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths lead, limits",
      "display": "Shares APIs across rate strategies",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths, limits",
      "display": "Switch strategies while retaining hit, test, and window-stat methods.",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths lead, limits",
      "display": "Provides synchronous and coroutine interfaces",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "strengths, limits",
      "display": "Use the async namespace for coroutine-based storage and strategies.",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations lead, limits",
      "display": "Fixed windows allow boundary bursts",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations, limits",
      "display": "Use a moving-window strategy when boundary bursts are unacceptable.",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "Quickstart, limits",
      "display": "from limits import storage\nbackend = storage.MemoryStorage()\n\nfrom limits import strategies\nstrategy = strategies.MovingWindowRateLimiter(backend)\n\nfrom limits import parse\none_per_minute = parse(\"1/minute\")\n\n\nfrom limits import RateLimitItemPerSecond\none_per_second = RateLimitItemPerSecond(1, 1)\n\n\nimport time\nassert True == strategy.hit(one_per_minute, \"test_namespace\", \"foo\")\nassert False == strategy.hit(one_per_minute, \"test_namespace\", \"foo\")\nassert True == strategy.hit(one_per_minute, \"test_namespace\", \"bar\")\n\nassert True == strategy.hit(one_per_second, \"test_namespace\", \"foo\")\nassert False == strategy.hit(one_per_second, \"test_namespace\", \"foo\")\ntime.sleep(1)\nassert True == strategy.hit(one_per_second, \"test_namespace\", \"foo\")\n\n",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "Project function, limits",
      "display": "def __evaluate_limits(self, endpoint: str, limits: list[RuntimeLimit]) -> None:\n    failed_limits: list[tuple[RuntimeLimit, list[str]]] = []\n    limit_for_header: RequestLimit | None = None\n    view_limits: list[RequestLimit] = []\n    meta_limits = [\n        meta_limit\n        for meta_limit in itertools.chain(\n            *self._meta_limits,\n            *[limit.meta_limits for limit in limits if limit.meta_limits],\n        )\n        if not meta_limit.is_exempt\n    ]\n    if not (\n        ExemptionScope.META\n        & self.limit_manager.exemption_scope(\n            flask.current_app, endpoint, flask.request.blueprint\n        )\n    ):\n        for lim in meta_limits:\n            limit_key, scope = lim.key_func(), lim.scope_for(endpoint, None)\n            args = [limit_key, scope]\n            on_breach = lim.on_breach or self._on_meta_breach\n            if not self.limiter.test(lim.limit, *args, cost=lim.deduction_amount):\n                breached_meta_limit = RequestLimit(self, lim.limit, args, True, lim.shared)\n                self.context.view_rate_limit = breached_meta_limit\n                self.context.view_rate_limits = [breached_meta_limit]\n                meta_breach_response = None\n\n                if on_breach:\n                    try:\n                        cb_response = on_breach(breached_meta_limit)\n\n                        if isinstance(cb_response, flask.wrappers.Response):\n                            meta_breach_response = cb_response\n                    except Exception as err:  # noqa\n                        if self._swallow_errors:\n                            self.logger.exception(\n                                \"on_meta_breach callback failed with error %s\", err\n                            )\n                        else:\n                            raise err\n                raise RateLimitExceeded(lim, response=meta_breach_response)\n\n    for lim in sorted(limits, key=lambda x: x.limit):\n        if lim.is_exempt or lim.method_exempt:\n            continue\n\n        limit_scope = lim.scope_for(endpoint, flask.request.method)\n        limit_key = lim.key_func()\n        args = [limit_key, limit_scope]\n        kwargs = {}\n\n        if not all(args):\n            self.logger.error(f\"Skipping limit: {lim.limit}. Empty value found in parameters.\")\n\n            continue\n\n        if self._key_prefix:\n            args = [self._key_prefix, *args]\n\n        if lim.deduct_when:\n            self.context.conditional_deductions[lim] = args\n            method = self.limiter.test\n        else:\n            method = self.limiter.hit\n        kwargs[\"cost\"] = lim.deduction_amount\n\n        request_limit = RequestLimit(self, lim.limit, args, False, lim.shared)\n        view_limits.append(request_limit)\n\n        if not method(lim.limit, *args, **kwargs):\n            self.logger.info(\n                \"ratelimit %s (%s) exceeded at endpoint: %s\",\n                lim.limit,\n                limit_key,\n                limit_scope,\n            )\n            failed_limits.append((lim, args))\n            view_limits[-1].breached = True\n            limit_for_header = view_limits[-1]\n\n            if self._fail_on_first_breach:\n                break\n\n    if not limit_for_header and view_limits:\n        # Pick a non shared limit over a shared one if possible\n        # when no rate limit has been hit. This should be the best hint\n        # for the client.\n        explicit = [limit for limit in view_limits if not limit.shared]\n        limit_for_header = explicit[0] if explicit else view_limits[0]\n\n    self.context.view_rate_limit = limit_for_header or None\n    self.context.view_rate_limits = view_limits\n\n    on_breach_response = None\n\n    for limit in failed_limits:\n        request_limit = RequestLimit(self, limit[0].limit, limit[1], True, limit[0].shared)\n\n        for cb in dict.fromkeys([self._on_breach, limit[0].on_breach]):\n            if cb:\n                try:\n                    cb_response = cb(request_limit)\n\n                    if isinstance(cb_response, flask.wrappers.Response):\n                        on_breach_response = cb_response\n                except Exception as err:  # noqa\n                    if self._swallow_errors:\n                        self.logger.exception(\"on_breach callback failed with error %s\", err)\n                    else:\n                        raise err\n\n    if failed_limits:\n        meta_limits = [\n            meta_limit\n            for meta_limit in itertools.chain(\n                *self._meta_limits,\n                *[list(lim[0].meta_limits) for lim in failed_limits if lim[0].meta_limits],\n            )\n            if not meta_limit.is_exempt\n        ]\n        for lim in meta_limits:\n            limit_scope = lim.scope_for(endpoint, flask.request.method)\n            limit_key = lim.key_func()\n            args = [limit_key, limit_scope]\n            self.limiter.hit(lim.limit, *args)\n        raise RateLimitExceeded(\n            sorted(failed_limits, key=lambda x: x[0].limit)[0][0],\n            response=on_breach_response,\n        )\n",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Project function reference, limits",
      "display": "_extension.py · __evaluate_limits()",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project repository, limits",
      "display": "alisaifee/flask-limiter",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project stars, alisaifee/flask-limiter",
      "display": "1.2K",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project push date, alisaifee/flask-limiter",
      "display": "May 2026",
      "asOf": "2026-05-10"
    },
    "F25": {
      "label": "Project function, limits",
      "display": "def rate_limit_ip(self, ip, username=None):\n    limiter = self.get_limiter(app.config['AUTH_RATELIMIT_IP'], 'auth-ip')\n    client_network = utils.extract_network_from_ip(ip)\n    if self.is_subject_to_rate_limits(ip):\n        if username and self.storage.get(f'dedup-{client_network}-{username}') > 0:\n            return\n        self.storage.incr(f'dedup-{client_network}-{username}', limits.parse(app.config['AUTH_RATELIMIT_IP']).GRANULARITY.seconds)\n        limiter.hit(client_network)\n",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Project function reference, limits",
      "display": "limiter.py · rate_limit_ip()",
      "asOf": "2026-11-17"
    },
    "F27": {
      "label": "Project repository, limits",
      "display": "Mailu/Mailu",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "Project stars, Mailu/Mailu",
      "display": "7.6K",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "Project push date, Mailu/Mailu",
      "display": "Nov 2026",
      "asOf": "2026-11-14"
    },
    "F30": {
      "label": "Library name, slowapi",
      "display": "SlowApi",
      "asOf": "2026-11-17"
    },
    "F31": {
      "label": "Monthly downloads, slowapi",
      "display": "24.0M",
      "asOf": "2026-11-16"
    },
    "F32": {
      "label": "License, slowapi",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Package release, slowapi",
      "display": "0.1.10, Jun 2026",
      "asOf": "2026-06-13"
    },
    "F34": {
      "label": "Package release date, slowapi",
      "display": "Jun 2026",
      "asOf": "2026-06-13"
    },
    "F35": {
      "label": "Repository stars, slowapi",
      "display": "2.1K",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "Uses Redis storage, slowapi",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "Uses memory storage, slowapi",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "Charges request costs, slowapi",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "Supports async functions, slowapi",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "Install, slowapi",
      "display": "pip install slowapi fastapi",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "What it does, slowapi",
      "display": "Adds rate limiting to Starlette and FastAPI HTTP endpoints.",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "strengths lead, slowapi",
      "display": "Fits asynchronous HTTP endpoints",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "strengths, slowapi",
      "display": "Limit synchronous or asynchronous routes through the same wrapper.",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "strengths lead, slowapi",
      "display": "Shares quotas across routes",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "strengths, slowapi",
      "display": "Apply shared limits to a selected set of routes.",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "limitations lead, slowapi",
      "display": "Endpoints need a request argument",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "limitations, slowapi",
      "display": "Include request in each rate-limited endpoint’s function signature.",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "limitations lead, slowapi",
      "display": "Decorator order affects enforcement",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "limitations, slowapi",
      "display": "Place the route decorator above the limit decorator.",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "limitations lead, slowapi",
      "display": "WebSocket routes are unsupported",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "limitations, slowapi",
      "display": "Use another limiter for WebSocket traffic.",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Quickstart, slowapi",
      "display": "from fastapi import FastAPI, Request, Response\nfrom slowapi import Limiter, _rate_limit_exceeded_handler\nfrom slowapi.util import get_remote_address\nfrom slowapi.errors import RateLimitExceeded\n\nlimiter = Limiter(key_func=get_remote_address)\napp = FastAPI()\napp.state.limiter = limiter\napp.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)\n\n# Note: the route decorator must be above the limit decorator, not below it\n@app.get(\"/home\")\n@limiter.limit(\"5/minute\")\nasync def home(request: Request):\n    return Response(\"test\")\n\n@app.get(\"/mars\")\n@limiter.limit(\"5/minute\")\nasync def mars(request: Request, response: Response):\n    return {\"key\": \"value\"}\n",
      "asOf": "2026-11-17"
    },
    "F53": {
      "label": "Library name, pyrate-limiter",
      "display": "PyrateLimiter",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Monthly downloads, pyrate-limiter",
      "display": "11.2M",
      "asOf": "2026-11-16"
    },
    "F55": {
      "label": "License, pyrate-limiter",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "Package release, pyrate-limiter",
      "display": "4.5.1, Oct 2026",
      "asOf": "2026-10-20"
    },
    "F57": {
      "label": "Package release date, pyrate-limiter",
      "display": "Oct 2026",
      "asOf": "2026-10-20"
    },
    "F58": {
      "label": "Repository stars, pyrate-limiter",
      "display": "534",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Uses Redis storage, pyrate-limiter",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Uses memory storage, pyrate-limiter",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Charges request costs, pyrate-limiter",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "Supports async functions, pyrate-limiter",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "Install, pyrate-limiter",
      "display": "pip install pyrate-limiter",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "What it does, pyrate-limiter",
      "display": "Provides configurable bucket algorithms and storage backends for rate limiting.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "strengths lead, pyrate-limiter",
      "display": "Chooses algorithms per bucket",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "strengths, pyrate-limiter",
      "display": "Set the bucket algorithm to match the allowed request pattern.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "strengths lead, pyrate-limiter",
      "display": "Can wait for available quota",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "strengths, pyrate-limiter",
      "display": "Choose blocking behavior or reject immediately when the bucket is full.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "limitations lead, pyrate-limiter",
      "display": "Sync acquisition can block",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "limitations, pyrate-limiter",
      "display": "Use try_acquire_async to wait without blocking the event loop.",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Quickstart, pyrate-limiter",
      "display": "import asyncio\nfrom pyrate_limiter import BucketAsyncWrapper, InMemoryBucket, Rate, Duration, Limiter\n\nasync def main():\n    limiter = Limiter(BucketAsyncWrapper(InMemoryBucket([Rate(5, Duration.SECOND)])))\n    try:\n        await limiter.try_acquire_async(\"item\")\n    finally:\n        limiter.close()\n\nasyncio.run(main())\n",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project function, pyrate-limiter",
      "display": "def send(self, request: PreparedRequest, **kwargs) -> Response:\n    \"\"\"Send a request with rate-limiting.\"\"\"\n    bucket_name = self._bucket_name(request)\n    timeout = self.max_delay if self.max_delay is not None else -1\n    acquired = self.limiter.try_acquire(bucket_name, weight=1, blocking=True, timeout=timeout)\n    if not acquired:\n        raise exceptions.Timeout(f'Rate limit not cleared within max_delay={self.max_delay}s')\n\n    response = super().send(request, **kwargs)\n    if response.status_code in self.limit_statuses:\n        self._fill_bucket(request)\n\n    return response\n",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project function reference, pyrate-limiter",
      "display": "requests_ratelimiter.py · send()",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project repository, pyrate-limiter",
      "display": "JWCook/requests-ratelimiter",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Project stars, JWCook/requests-ratelimiter",
      "display": "119",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Project push date, JWCook/requests-ratelimiter",
      "display": "Aug 2026",
      "asOf": "2026-08-25"
    },
    "F77": {
      "label": "Library name, Flask-Limiter",
      "display": "Flask-Limiter",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Monthly downloads, Flask-Limiter",
      "display": "7.2M",
      "asOf": "2026-11-16"
    },
    "F79": {
      "label": "License, Flask-Limiter",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Package release, Flask-Limiter",
      "display": "4.1.1, Dec 2025",
      "asOf": "2025-12-06"
    },
    "F81": {
      "label": "Package release date, Flask-Limiter",
      "display": "Dec 2025",
      "asOf": "2025-12-06"
    },
    "F82": {
      "label": "Repository stars, Flask-Limiter",
      "display": "1.2K",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "Uses Redis storage, Flask-Limiter",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "Uses memory storage, Flask-Limiter",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "Charges request costs, Flask-Limiter",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "Install, Flask-Limiter",
      "display": "pip install Flask-Limiter",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "What it does, Flask-Limiter",
      "display": "Adds configurable request limits to Flask routes.",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "strengths lead, Flask-Limiter",
      "display": "Charges custom request costs",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "strengths, Flask-Limiter",
      "display": "Charge different amounts of quota for different requests.",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "strengths lead, Flask-Limiter",
      "display": "Customizes client identity keys",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "strengths, Flask-Limiter",
      "display": "Derive the rate-limit key from characteristics of the request.",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "limitations lead, Flask-Limiter",
      "display": "Memory storage is development-only",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "limitations, Flask-Limiter",
      "display": "Configure another storage backend before deploying to production.",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "Quickstart, Flask-Limiter",
      "display": "# app.py\n\nfrom flask import Flask\nfrom flask_limiter import Limiter\nfrom flask_limiter.util import get_remote_address\n\napp = Flask(__name__)\nlimiter = Limiter(\n    get_remote_address,\n    app=app,\n    default_limits=[\"2 per minute\", \"1 per second\"],\n    storage_uri=\"memory://\",\n    # Redis\n    # storage_uri=\"redis://localhost:6379\",\n    # Redis cluster\n    # storage_uri=\"redis+cluster://localhost:7000,localhost:7001,localhost:70002\",\n    # Memcached\n    # storage_uri=\"memcached://localhost:11211\",\n    # Memcached Cluster\n    # storage_uri=\"memcached://localhost:11211,localhost:11212,localhost:11213\",\n    # MongoDB\n    # storage_uri=\"mongodb://localhost:27017\",\n    strategy=\"fixed-window\", # or \"moving-window\", or \"sliding-window-counter\"\n)\n\n@app.route(\"/slow\")\n@limiter.limit(\"1 per day\")\ndef slow():\n    return \"24\"\n\n@app.route(\"/fast\")\ndef fast():\n    return \"42\"\n\n@app.route(\"/ping\")\n@limiter.exempt\ndef ping():\n    return 'PONG'\n\n",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Project function, Flask-Limiter",
      "display": "def create_limiter(self, app: Flask) -> Limiter:\n    limiter = Limiter(\n        key_func=app.config.get(\"RATELIMIT_KEY_FUNC\", get_remote_address)\n    )\n    limiter.init_app(app)\n    return limiter\n",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Project function reference, Flask-Limiter",
      "display": "manager.py · create_limiter()",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Project repository, Flask-Limiter",
      "display": "dpgaspar/Flask-AppBuilder",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Project stars, dpgaspar/Flask-AppBuilder",
      "display": "5.0K",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Project push date, dpgaspar/Flask-AppBuilder",
      "display": "Nov 2026",
      "asOf": "2026-11-05"
    },
    "F100": {
      "label": "Developer need",
      "display": "Interchangeable rate strategies",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Why choose limits",
      "display": "a common API across rate-limiting strategies",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Developer need in introduction",
      "display": "interchangeable rate strategies",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Developer need",
      "display": "FastAPI and Starlette endpoints",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Why choose slowapi",
      "display": "limiting synchronous or asynchronous HTTP views",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need in introduction",
      "display": "FastAPI and Starlette endpoints",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Developer need",
      "display": "Flask request policies",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Why choose Flask-Limiter",
      "display": "charging custom request costs",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need in introduction",
      "display": "Flask request policies",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "When to consider slowapi",
      "display": "the application uses FastAPI or Starlette",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Developer need",
      "display": "Client-side quota acquisition",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "Why choose pyrate-limiter",
      "display": "waiting for quota or rejecting immediately",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "Developer need in introduction",
      "display": "client-side quota acquisition",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "When to consider limits",
      "display": "interchangeable request-window strategies are the main requirement",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "Page introduction",
      "display": "Python rate limiting libraries let backend developers limit how often operations can run.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: Which Python rate limiter should I choose?",
      "display": "limits provides shared APIs across its strategies.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: Which Python rate limiter should I choose?",
      "display": "SlowApi adapts rate limiting to Starlette and FastAPI.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Which Python rate limiter should I choose?",
      "display": "Flask-Limiter supports request-specific costs.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Which Python rate limiter should I choose?",
      "display": "PyrateLimiter supports blocking or immediate rejection.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: Do Redis-backed rate limits need another Python dependency?",
      "display": "limits declares an optional Redis dependency.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Do Redis-backed rate limits need another Python dependency?",
      "display": "Flask-Limiter exposes a Redis extra.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Do Redis-backed rate limits need another Python dependency?",
      "display": "PyrateLimiter provides an optional Redis extra.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Does limits provide coroutine-based storage and strategies?",
      "display": "The limits.aio namespace mirrors the synchronous storage and strategy APIs.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: Can a rate-limited SlowApi endpoint omit request?",
      "display": "The endpoint must explicitly accept request for the limiter to attach to it.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Where should the SlowApi limit decorator go?",
      "display": "Place the FastAPI route decorator above the limiter decorator.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: Can SlowApi limit WebSocket endpoints?",
      "display": "WebSocket endpoints are not supported.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: Can Flask-Limiter charge different costs for requests?",
      "display": "The limit and shared_limit decorators accept a static integer or a callable request cost.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "FAQ: Is Flask-Limiter memory storage intended for production?",
      "display": "Replace the development in-memory backend with appropriate production storage.",
      "asOf": "2026-11-17"
    },
    "F128": {
      "label": "FAQ: Can fixed-window rate limits allow boundary bursts?",
      "display": "Fixed-window boundary bursts remain possible; select another strategy when that behavior is unacceptable.",
      "asOf": "2026-11-17"
    },
    "F129": {
      "label": "FAQ: How should PyrateLimiter wait inside an event loop?",
      "display": "Use try_acquire_async so waiting uses asyncio.sleep instead of blocking the event loop.",
      "asOf": "2026-11-17"
    },
    "F130": {
      "label": "Library name, limits",
      "display": "limits",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Monthly downloads, limits",
      "display": "43.7M",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "License, limits",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Package release, limits",
      "display": "5.8.0",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Package release date, limits",
      "display": "Feb 2026",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Install, limits",
      "display": "python3.13 -m pip install limits==5.8.0",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Quickstart, limits",
      "display": "from limits import parse\nfrom limits.storage import MemoryStorage\nfrom limits.strategies import MovingWindowRateLimiter\n\nlimiter = MovingWindowRateLimiter(MemoryStorage())\nrate = parse(\"1/minute\")\nprint(limiter.hit(rate, \"example\"))",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "External shared quota state, limits",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Waits for quota, limits",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Native policy and integration role, limits",
      "display": "Storage/algorithm layer with explicit test/hit APIs and sync/async strategies. Flask-Limiter and SlowAPI consume this package; their installs overlap its counter.",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Original current-API workflow, limits",
      "display": "Flask-Limiter imports limits strategies and constructs the selected RateLimiter from the native RATELIMITERS registry; its limiter property returns that actual instance. Whole __evaluate_limits calls test without consuming quota, binds method to test or hit, invokes that bound method, and records meta-limit hits. Current5.8 documents RateLimitItem, variable string identifiers, integer cost, and Boolean test/hit results. deduction_amount and scope/key functions are original host inputs and must satisfy those contracts. Flask callbacks, RequestLimit wrappers, header selection, and app logging are not extra Limits calls. A missing/empty key/scope skips that host limit in the preserved code; this is Flask-Limiter behavior, not a universal backend limitation.",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Project function, limits",
      "display": "def __evaluate_limits(self, endpoint: str, limits: list[RuntimeLimit]) -> None:\n    failed_limits: list[tuple[RuntimeLimit, list[str]]] = []\n    limit_for_header: RequestLimit | None = None\n    view_limits: list[RequestLimit] = []\n    meta_limits = [\n        meta_limit\n        for meta_limit in itertools.chain(\n            *self._meta_limits,\n            *[limit.meta_limits for limit in limits if limit.meta_limits],\n        )\n        if not meta_limit.is_exempt\n    ]\n    if not (\n        ExemptionScope.META\n        & self.limit_manager.exemption_scope(\n            flask.current_app, endpoint, flask.request.blueprint\n        )\n    ):\n        for lim in meta_limits:\n            limit_key, scope = lim.key_func(), lim.scope_for(endpoint, None)\n            args = [limit_key, scope]\n            on_breach = lim.on_breach or self._on_meta_breach\n            if not self.limiter.test(lim.limit, *args, cost=lim.deduction_amount):\n                breached_meta_limit = RequestLimit(self, lim.limit, args, True, lim.shared)\n                self.context.view_rate_limit = breached_meta_limit\n                self.context.view_rate_limits = [breached_meta_limit]\n                meta_breach_response = None\n\n                if on_breach:\n                    try:\n                        cb_response = on_breach(breached_meta_limit)\n\n                        if isinstance(cb_response, flask.wrappers.Response):\n                            meta_breach_response = cb_response\n                    except Exception as err:  # noqa\n                        if self._swallow_errors:\n                            self.logger.exception(\n                                \"on_meta_breach callback failed with error %s\", err\n                            )\n                        else:\n                            raise err\n                raise RateLimitExceeded(lim, response=meta_breach_response)\n\n    for lim in sorted(limits, key=lambda x: x.limit):\n        if lim.is_exempt or lim.method_exempt:\n            continue\n\n        limit_scope = lim.scope_for(endpoint, flask.request.method)\n        limit_key = lim.key_func()\n        args = [limit_key, limit_scope]\n        kwargs = {}\n\n        if not all(args):\n            self.logger.error(f\"Skipping limit: {lim.limit}. Empty value found in parameters.\")\n\n            continue\n\n        if self._key_prefix:\n            args = [self._key_prefix, *args]\n\n        if lim.deduct_when:\n            self.context.conditional_deductions[lim] = args\n            method = self.limiter.test\n        else:\n            method = self.limiter.hit\n        kwargs[\"cost\"] = lim.deduction_amount\n\n        request_limit = RequestLimit(self, lim.limit, args, False, lim.shared)\n        view_limits.append(request_limit)\n\n        if not method(lim.limit, *args, **kwargs):\n            self.logger.info(\n                \"ratelimit %s (%s) exceeded at endpoint: %s\",\n                lim.limit,\n                limit_key,\n                limit_scope,\n            )\n            failed_limits.append((lim, args))\n            view_limits[-1].breached = True\n            limit_for_header = view_limits[-1]\n\n            if self._fail_on_first_breach:\n                break\n\n    if not limit_for_header and view_limits:\n        # Pick a non shared limit over a shared one if possible\n        # when no rate limit has been hit. This should be the best hint\n        # for the client.\n        explicit = [limit for limit in view_limits if not limit.shared]\n        limit_for_header = explicit[0] if explicit else view_limits[0]\n\n    self.context.view_rate_limit = limit_for_header or None\n    self.context.view_rate_limits = view_limits\n\n    on_breach_response = None\n\n    for limit in failed_limits:\n        request_limit = RequestLimit(self, limit[0].limit, limit[1], True, limit[0].shared)\n\n        for cb in dict.fromkeys([self._on_breach, limit[0].on_breach]):\n            if cb:\n                try:\n                    cb_response = cb(request_limit)\n\n                    if isinstance(cb_response, flask.wrappers.Response):\n                        on_breach_response = cb_response\n                except Exception as err:  # noqa\n                    if self._swallow_errors:\n                        self.logger.exception(\"on_breach callback failed with error %s\", err)\n                    else:\n                        raise err\n\n    if failed_limits:\n        meta_limits = [\n            meta_limit\n            for meta_limit in itertools.chain(\n                *self._meta_limits,\n                *[list(lim[0].meta_limits) for lim in failed_limits if lim[0].meta_limits],\n            )\n            if not meta_limit.is_exempt\n        ]\n        for lim in meta_limits:\n            limit_scope = lim.scope_for(endpoint, flask.request.method)\n            limit_key = lim.key_func()\n            args = [limit_key, limit_scope]\n            self.limiter.hit(lim.limit, *args)\n        raise RateLimitExceeded(\n            sorted(failed_limits, key=lambda x: x[0].limit)[0][0],\n            response=on_breach_response,\n        )",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Project source file, limits",
      "display": "flask_limiter/_extension.py",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Project full_name, limits",
      "display": "alisaifee/flask-limiter",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Project stargazers_count, limits",
      "display": "1.2K",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Library name, djangorestframework",
      "display": "Django REST framework",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Monthly downloads, djangorestframework",
      "display": "30.3M",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "License, djangorestframework",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Package release, djangorestframework",
      "display": "3.18.3",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Package release date, djangorestframework",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Install, djangorestframework",
      "display": "python3.13 -m pip install djangorestframework==3.18.3",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Quickstart, djangorestframework",
      "display": "from django.contrib.auth.models import AnonymousUser\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.throttling import UserRateThrottle\n\nclass ExampleThrottle(UserRateThrottle):\n    rate = \"2/minute\"\n\nrequest = APIRequestFactory().get(\"/\")\nrequest.user = AnonymousUser()\nprint(ExampleThrottle().allow_request(request, view=None))",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Official description, djangorestframework",
      "display": "Builds web APIs for Django.",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Quickstart source file, djangorestframework",
      "display": "throttling.py",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "External shared quota state, djangorestframework",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Waits for quota, djangorestframework",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Native policy and integration role, djangorestframework",
      "display": "Django REST request throttles for user, anonymous-client, and scoped business quotas; uses the configured Django cache and rejects excess requests rather than waiting.",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Original current-API workflow, djangorestframework",
      "display": "Meet imports actual rest_framework.throttling.UserRateThrottle. RequestEntryAuthenticatedUserRateThrottle inherits MonitoredUserRateThrottle(MonitoredThrottleMixin,UserRateThrottle); retained django-lasuite mixin source only overrides throttle_failure and does not intercept get_cache_key. Thus super().get_cache_key is the current native DRF method. Current3.18.3 public source retains request.user authentication/ID versus IP lookup and cache_format. Whole eight-line override declines anonymous users and otherwise delegates, with scope=request_entry supplied by its containing class. Settings, Django request/user, and the surrounding rate policy remain host requirements. This is one native call in a bounded task-specific throttle method, not three calls from unrelated decorators/helpers.",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Concurrency/security guarantee, djangorestframework",
      "display": "{\"quota_updates\": \"non-atomic built-in cache operations\", \"guarantee\": \"best-effort business-tier throttling\", \"excluded_promise\": \"strict security/brute-force/DoS protection\"}",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Project function, djangorestframework",
      "display": "def get_cache_key(self, request, view):\n    \"\"\"Use the authenticated user ID as the throttle cache key.\"\"\"\n\n    if request.user and not request.user.is_authenticated:\n        return None  # Defer to RequestEntryAnonRateThrottle for anonymous users.\n\n    return super().get_cache_key(request, view)",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Project source file, djangorestframework",
      "display": "src/backend/core/api/throttling.py",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Project full_name, djangorestframework",
      "display": "suitenumerique/meet",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Project stargazers_count, djangorestframework",
      "display": "2.5K",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Library name, slowapi",
      "display": "slowapi",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Monthly downloads, slowapi",
      "display": "24.9M",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "License, slowapi",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Package release, slowapi",
      "display": "0.1.10",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Package release date, slowapi",
      "display": "Jun 2026",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Install, slowapi",
      "display": "python3.13 -m pip install slowapi==0.1.10 starlette",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Quickstart, slowapi",
      "display": "from starlette.applications import Starlette\nfrom starlette.requests import Request\nfrom starlette.responses import PlainTextResponse\nfrom slowapi import Limiter, _rate_limit_exceeded_handler\nfrom slowapi.errors import RateLimitExceeded\nfrom slowapi.util import get_remote_address\n\nlimiter = Limiter(key_func=get_remote_address)\napp = Starlette()\napp.state.limiter = limiter\napp.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)\n\n@limiter.limit(\"5/minute\")\nasync def homepage(request: Request):\n    return PlainTextResponse(\"test\")\n\napp.add_route(\"/home\", homepage)",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "External shared quota state, slowapi",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Waits for quota, slowapi",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Native policy and integration role, slowapi",
      "display": "Decorator integration for Starlette/FastAPI HTTP endpoints, using Limits-backed storage. Request arguments and decorator order matter; WebSocket endpoints are not supported by its documented integration.",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Original current-API workflow, slowapi",
      "display": "MLflow directly imports Limiter from slowapi, annotates the supplied limiter, and creates that actual SDK object in the same retained module. Whole endpoint factory builds an existing handler and, only when a route has a configured limit, applies limiter.limit(limit_value)(handler). Current0.1.10 supports limit strings and sync/async HTTP endpoint decoration. The rate values are MLflow config, and its route factories supply Request-bearing handlers; neither app factories nor rename assignments are extra SDK calls. One 27-line task-specific integration function qualifies the bounded exception. This registers a policy; it does not make an HTTP/model request.",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Project function, slowapi",
      "display": "def _get_endpoint_handler(gateway_api: GatewayAPI, name: str, limiter: Limiter, key: str):\n    endpoint_type_to_factory = {\n        EndpointType.LLM_V1_CHAT: _create_chat_endpoint,\n        EndpointType.LLM_V1_COMPLETIONS: _create_completions_endpoint,\n        EndpointType.LLM_V1_EMBEDDINGS: _create_embeddings_endpoint,\n    }\n    provider, endpoint_type = gateway_api._get_provider_by_name(name)\n\n    if factory := endpoint_type_to_factory.get(endpoint_type):\n        handler = factory(provider)\n\n        if name in gateway_api.dynamic_endpoints:\n            limit = gateway_api.dynamic_endpoints[name].limit\n        else:\n            limit = None\n\n        if limit:\n            limit_value = f\"{limit.calls}/{limit.renewal_period}\"\n            handler.__name__ = f\"{handler.__name__}_{name}_{key}\"\n            return limiter.limit(limit_value)(handler)\n        else:\n            return handler\n\n    raise HTTPException(\n        status_code=404,\n        detail=f\"Unexpected route type {endpoint_type!r} for route {name!r}.\",\n    )",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Project source file, slowapi",
      "display": "mlflow/gateway/app.py",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Project full_name, slowapi",
      "display": "mlflow/mlflow",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Project stargazers_count, slowapi",
      "display": "28.9K",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Library name, aiolimiter",
      "display": "aiolimiter",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Monthly downloads, aiolimiter",
      "display": "16.0M",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "License, aiolimiter",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Package release, aiolimiter",
      "display": "1.3.0",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Package release date, aiolimiter",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Install, aiolimiter",
      "display": "python3.13 -m pip install aiolimiter==1.3.0",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Quickstart, aiolimiter",
      "display": "import asyncio\nfrom aiolimiter import AsyncLimiter\n\nasync def main():\n    limiter = AsyncLimiter(100)\n    async with limiter:\n        print(\"permit acquired\")\n\nasyncio.run(main())",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Official description, aiolimiter",
      "display": "Limits asyncio code with a leaky bucket.",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Quickstart source file, aiolimiter",
      "display": "index.html",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "External shared quota state, aiolimiter",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Waits for quota, aiolimiter",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Native policy and integration role, aiolimiter",
      "display": "Awaitable leaky-bucket acquisition in one asyncio loop, with weighted acquisitions and initial bursts up to max_rate. This is outbound/task pacing, not an automatic HTTP429 middleware.",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Original current-API workflow, aiolimiter",
      "display": "python-telegram-bot imports actual AsyncLimiter and creates _apb_limiter/_base_limiter in __init__, while _get_group_limiter returns another AsyncLimiter. Current1.3 docs explicitly support async-with acquisition on those objects. The whole _run_request has three conditional native context-entry sites: paid-broadcast limiter, group limiter, and base limiter; null_context alternatives do not acquire quota. This is not three acquisitions on every request. The inner event wait and callback await are peer/application operations and do not inflate native counts. Existing event loop, configured limits, callback, and Telegram-specific branching are original host context. No callback, paid request, Telegram connection, or loop ran.",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Event-loop, burst, and weight behavior, aiolimiter",
      "display": "{\"lifetime\": \"one limiter per asyncio loop\", \"initial_burst\": \"up to max_rate\", \"mixed_weights\": \"small acquisitions can overtake larger ones near saturation\"}",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Project function, aiolimiter",
      "display": "async def _run_request(\n    self,\n    chat: bool,\n    group: str | int | bool,\n    allow_paid_broadcast: bool,\n    callback: Callable[..., Coroutine[Any, Any, bool | JSONDict | list[JSONDict]]],\n    args: Any,\n    kwargs: dict[str, Any],\n) -> bool | JSONDict | list[JSONDict]:\n    async def inner() -> bool | JSONDict | list[JSONDict]:\n        # In case a retry_after was hit, we wait with processing the request\n        await self._retry_after_event.wait()\n        return await callback(*args, **kwargs)\n\n    if allow_paid_broadcast:\n        async with self._apb_limiter:\n            return await inner()\n    else:\n        base_context = self._base_limiter if (chat and self._base_limiter) else null_context()\n        group_context = (\n            self._get_group_limiter(group)\n            if group and self._group_max_rate\n            else null_context()\n        )\n\n        async with group_context, base_context:\n            return await inner()",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Project source file, aiolimiter",
      "display": "src/telegram/ext/_aioratelimiter.py",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "Project full_name, aiolimiter",
      "display": "python-telegram-bot/python-telegram-bot",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Project stargazers_count, aiolimiter",
      "display": "29.6K",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Library name, ratelimit",
      "display": "ratelimit",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Monthly downloads, ratelimit",
      "display": "15.4M",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "License, ratelimit",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Package release, ratelimit",
      "display": "2.2.1",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Package release date, ratelimit",
      "display": "Dec 2018",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Install, ratelimit",
      "display": "python3.13 -m pip install ratelimit==2.2.1",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Quickstart, ratelimit",
      "display": "from ratelimit import limits\n\n@limits(calls=1, period=1)\ndef example():\n    return \"permitted\"\n\nprint(example())",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Official description, ratelimit",
      "display": "Limits API calls through a function decorator.",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Quickstart source file, ratelimit",
      "display": "json",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "External shared quota state, ratelimit",
      "display": "Undocumented",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Waits for quota, ratelimit",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Native policy and integration role, ratelimit",
      "display": "Function-call decorator plus optional synchronous sleep-and-retry helper. Blocking sleeps occupy the calling thread, and it is not an asyncio acquisition API.",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Original current-API workflow, ratelimit",
      "display": "DataHub imports limits and sleep_and_retry from ratelimit. Whole get_rate_limited_emit_mcp builds the original emitter wrapper with both native decorators; stdlib wraps and emitter.emit_mcp are not Ratellimit calls. Current2.2.1 README documents limits(calls,period) and sleep_and_retry, which blocks the calling thread when the decorated function is rate limited. Two decorator APIs are native application sites even though actual metadata emission happens later through the returned callable. Values must be appropriate positive call/period config. No emitter or HTTP request ran.",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Project function, ratelimit",
      "display": "def get_rate_limited_emit_mcp(self, emitter: DataHubGraph) -> Any:\n    \"\"\"\n    Returns a rate limited emitter that can be used to emit metadata for propagation\n    \"\"\"\n\n    @sleep_and_retry\n    @limits(\n        calls=self.rate_limit_propagated_writes,\n        period=self.rate_limit_propagated_writes_period,\n    )\n    @wraps(emitter.emit_mcp)\n    def wrapper(*args, **kwargs):\n        return emitter.emit_mcp(*args, **kwargs)\n\n    return wrapper",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Project source file, ratelimit",
      "display": "datahub-actions/src/datahub_actions/plugin/action/propagation/propagation_utils.py",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Project full_name, ratelimit",
      "display": "datahub-project/datahub",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Project stargazers_count, ratelimit",
      "display": "13.0K",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Library name, pyrate-limiter",
      "display": "PyrateLimiter",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Monthly downloads, pyrate-limiter",
      "display": "11.9M",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "License, pyrate-limiter",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Package release, pyrate-limiter",
      "display": "4.5.1",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Package release date, pyrate-limiter",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Install, pyrate-limiter",
      "display": "python3.13 -m pip install pyrate-limiter==4.5.1",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Quickstart, pyrate-limiter",
      "display": "from pyrate_limiter import Duration, Rate, Limiter\n\nlimiter = Limiter(Rate(5, Duration.SECOND * 2))\nprint(limiter.try_acquire(\"my-resource\"))",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "External shared quota state, pyrate-limiter",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Waits for quota, pyrate-limiter",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Native policy and integration role, pyrate-limiter",
      "display": "Per-key quota permits with sync/async paths, blocking/nonblocking/timeout modes, multiple rates, pluggable algorithms, and optional persistent/shared stores. v4 behavior differs from older exception/context-manager integrations.",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Original current-API workflow, pyrate-limiter",
      "display": "Schemathesis imports current Limiter and Rate inside build_limiter, parses the caller rate string through its original parse_units helper, then constructs Limiter(Rate(limit,interval)). Current4.5.1 explicitly documents this v4 shortcut; rates require supported positive bounds. parse_units accepts only s/m/h/d and translates them through actual Duration members. The two constructors are native, while string parsing and exception conversion are host operations. This immutable function is not the older Requests-Ratelimiter context-manager integration and is not rejected merely for an old consumer pin.",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Project function, pyrate-limiter",
      "display": "def build_limiter(rate: str) -> Limiter:\n    from pyrate_limiter import Limiter, Rate\n\n    limit, interval = parse_units(rate)\n    return Limiter(Rate(limit, interval))",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Project source file, pyrate-limiter",
      "display": "src/schemathesis/core/rate_limit.py",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Project full_name, pyrate-limiter",
      "display": "schemathesis/schemathesis",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Project stargazers_count, pyrate-limiter",
      "display": "3.8K",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Library name, flask-limiter",
      "display": "Flask-Limiter",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Monthly downloads, flask-limiter",
      "display": "7.5M",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "License, flask-limiter",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Package release, flask-limiter",
      "display": "4.1.1",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Package release date, flask-limiter",
      "display": "Dec 2025",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Install, flask-limiter",
      "display": "python3.13 -m pip install flask-limiter==4.1.1 flask==3.1.3",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "Quickstart, flask-limiter",
      "display": "from flask import Flask\nfrom flask_limiter import Limiter\nfrom flask_limiter.util import get_remote_address\n\napp = Flask(__name__)\nlimiter = Limiter(get_remote_address, app=app)\n\n@app.get(\"/\")\n@limiter.limit(\"5/minute\")\ndef index():\n    return \"permitted\"",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Official description, flask-limiter",
      "display": "Adds rate limiting to Flask applications.",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Quickstart source file, flask-limiter",
      "display": "api.html",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "External shared quota state, flask-limiter",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Waits for quota, flask-limiter",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Native policy and integration role, flask-limiter",
      "display": "Flask request decorators, defaults, shared/meta limits, and breach callbacks, backed by Limits strategies/storage. Memory fallback is distinct from shared deployment state.",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Original current-API workflow, flask-limiter",
      "display": "Flask-AppBuilder imports actual Flask-Limiter Limiter and configures key_func from its Flask app or the documented get_remote_address default. Current4.1.1 accepts keyword key_func and retains init_app(app), returning a configured Limiter from the original method. The two SDK calls are constructor and init_app; app.config.get is a host lookup. A live configured Flask app is required when a developer uses this integration, but no request context, application, or plugin was run here.",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Project function, flask-limiter",
      "display": "def create_limiter(self, app: Flask) -> Limiter:\n    limiter = Limiter(\n        key_func=app.config.get(\"RATELIMIT_KEY_FUNC\", get_remote_address)\n    )\n    limiter.init_app(app)\n    return limiter",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "Project source file, flask-limiter",
      "display": "flask_appbuilder/security/manager.py",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Project full_name, flask-limiter",
      "display": "dpgaspar/Flask-AppBuilder",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Project stargazers_count, flask-limiter",
      "display": "5.0K",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "Library name, django-axes",
      "display": "django-axes",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Monthly downloads, django-axes",
      "display": "5.0M",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "License, django-axes",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "Package release, django-axes",
      "display": "9.0.0",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Package release date, django-axes",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F250": {
      "label": "Install, django-axes",
      "display": "python3.13 -m pip install django-axes==9.0.0",
      "asOf": "2026-11-20"
    },
    "F251": {
      "label": "Quickstart, django-axes",
      "display": "from django.test import RequestFactory\nfrom axes.handlers.proxy import AxesProxyHandler\n\nrequest = RequestFactory().post(\"/login/\")\nprint(AxesProxyHandler.is_allowed(request, {\"username\": \"example\"}))",
      "asOf": "2026-11-20"
    },
    "F252": {
      "label": "Official description, django-axes",
      "display": "Tracks failed login attempts on Django sites.",
      "asOf": "2026-11-20"
    },
    "F253": {
      "label": "Quickstart source file, django-axes",
      "display": "proxy.py",
      "asOf": "2026-11-20"
    },
    "F254": {
      "label": "External shared quota state, django-axes",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F255": {
      "label": "Waits for quota, django-axes",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F256": {
      "label": "Native policy and integration role, django-axes",
      "display": "Django failed-login tracking and lockout by username/IP/other configured keys. Optional cooldown and database/cache handlers differ from a general quota on every successful request.",
      "asOf": "2026-11-20"
    },
    "F257": {
      "label": "Original current-API workflow, django-axes",
      "display": "Baby Buddy imports reset directly from axes.utils. Whole UserUnlock.post obtains an existing user/form and resets username attempts only after form validation. Current9.0.0 utils.reset accepts username and returns an integer count, which this function intentionally ignores. Its configured view/mixins own staff permission and form behavior; the selected function does not establish authorization independently. One unchanged eight-line task-specific account-unlock method qualifies the bounded exception. No account, database, lockout record, or permission was changed.",
      "asOf": "2026-11-20"
    },
    "F258": {
      "label": "Current failed-login policy boundaries, django-axes",
      "display": "{\"python_floor\": \"3.11\", \"django_floor\": \"5.2\", \"migrations\": \"required9.0 upgrade step\", \"username_key\": \"values are truncated to the configured username field maximum before tracking\", \"cooldown\": \"optional configured lockout cooldown, not waiting for a callable permit\"}",
      "asOf": "2026-11-20"
    },
    "F259": {
      "label": "Project function, django-axes",
      "display": "def post(self, request, *args, **kwargs):\n    user = self.get_object()\n    form = self.get_form()\n    if form.is_valid():\n        reset(username=user.username)\n        return self.form_valid(form)\n    else:\n        return self.form_invalid(form)",
      "asOf": "2026-11-20"
    },
    "F260": {
      "label": "Project source file, django-axes",
      "display": "babybuddy/views.py",
      "asOf": "2026-11-20"
    },
    "F261": {
      "label": "Project full_name, django-axes",
      "display": "babybuddy/babybuddy",
      "asOf": "2026-11-20"
    },
    "F262": {
      "label": "Project stargazers_count, django-axes",
      "display": "3.0K",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python rate limiting libraries limits SlowApi Flask-Limiter PyrateLimiter examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
