diff --git a/README.md b/README.md index dcca572..644571d 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,12 @@ from requests import Response from rate_keeper import RateKeeper -timestamp_clock = datetime.now(timezone.utc).timestamp + +# UTC timestamp clock +def timestamp_clock(): + return datetime.now(timezone.utc).timestamp() + + rate_keeper = RateKeeper(limit=5000, period=3600, clock=timestamp_clock) diff --git a/README_ZH.md b/README_ZH.md index 7ace712..a4b4608 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -53,7 +53,12 @@ from requests import Response from rate_keeper import RateKeeper -timestamp_clock = datetime.now(timezone.utc).timestamp + +# UTC timestamp clock +def timestamp_clock(): + return datetime.now(timezone.utc).timestamp() + + rate_keeper = RateKeeper(limit=5000, period=3600, clock=timestamp_clock) diff --git a/examples/github_api.py b/examples/github_api.py index a7fc94a..b9da2c5 100644 --- a/examples/github_api.py +++ b/examples/github_api.py @@ -6,7 +6,12 @@ from rate_keeper import RateKeeper -timestamp_clock = datetime.now(timezone.utc).timestamp + +# UTC timestamp clock +def timestamp_clock(): + return datetime.now(timezone.utc).timestamp() + + rate_keeper = RateKeeper(limit=5000, period=3600, clock=timestamp_clock) diff --git a/pyproject.toml b/pyproject.toml index dc71db7..ad9dcb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "rate-keeper" -version = "0.4.0" +version = "0.4.1" description = "Used to limit function call frequency. It ensures your function is called evenly within the limit rather than being called intensively in a short time." authors = [{ name = "ftnfurina", email = "ftnfurina@gmail.com" }] dependencies = ["requests>=2.32.3"]