{"id":15009897,"url":"https://github.com/jamesqin-cn/tinylimit","last_synced_at":"2026-01-31T07:31:04.298Z","repository":{"id":57475761,"uuid":"240674068","full_name":"jamesqin-cn/tinylimit","owner":"jamesqin-cn","description":"tinylimit is a python modules that limits or anti-limits the calling rate of a function","archived":false,"fork":false,"pushed_at":"2020-02-15T09:05:30.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T22:55:51.370Z","etag":null,"topics":["limit","pip","python2","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesqin-cn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-15T09:03:10.000Z","updated_at":"2023-02-06T18:20:22.000Z","dependencies_parsed_at":"2022-09-07T13:51:34.629Z","dependency_job_id":null,"html_url":"https://github.com/jamesqin-cn/tinylimit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jamesqin-cn/tinylimit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesqin-cn%2Ftinylimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesqin-cn%2Ftinylimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesqin-cn%2Ftinylimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesqin-cn%2Ftinylimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesqin-cn","download_url":"https://codeload.github.com/jamesqin-cn/tinylimit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesqin-cn%2Ftinylimit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28933210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T04:05:25.756Z","status":"ssl_error","status_checked_at":"2026-01-31T04:02:35.005Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["limit","pip","python2","python3"],"created_at":"2024-09-24T19:29:03.684Z","updated_at":"2026-01-31T07:31:04.278Z","avatar_url":"https://github.com/jamesqin-cn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiny Limit\n\n## What is TinyLimit?\ntinylimit is a python modules that limits and anti-limits the calling rate of a function\n与其他的limit库所不同的是，tinylimit在实战中考虑到了这些因素：\n- 提供anti-limit的方法\n\n    为了让client无视被调用函数所做出的limit限制，我们提供将调用结果保存下来，如果达到被调函数已达调用频率上线，client不是直接报错，而是直接返回最近一次的调用缓存，在某些场景下（比如获取某一日的PV），读取缓存数据并不会令程序逻辑紊乱，却避免了client堵塞。这样client可以按自己的需要随意调用受限函数即可，避免client写冗长的容错逻辑\n\n- 根据上下文施加limit\n\n    大部分的limit库是以函数为单位做limit，实际上很多第三方的API接口的限制单位为token，不同的token不会共享同一个limit额度，所以以函数名为指纹太泛，我们这里取了类实例的上下文、函数名、函数的参数列表三类信息来形成被调对象的指纹，用以应对这类场景\n\n## Programming Language\n- python 2.7\n- python 3.7\n\n## Install\n```\npip install tinylimit \n```\n\n## Quick Start\nuse python decorators syntax to wrap the call target\n```\nfrom tinylimit import AntiLimit\n\n@AntiLimit(2,1)\ndef Add(a, b):\n    return a + b\n\nclass Foo():\n    @AntiLimit(2,1)\n    def Bar(self, a, b):\n        return a - b\n```\n\n## Functions List\n- AntiLimit()","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesqin-cn%2Ftinylimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesqin-cn%2Ftinylimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesqin-cn%2Ftinylimit/lists"}