[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1084153: ITP: python-ratelimit -- API rate limit decorator



Hi,

If you are in a hurry, you can try to replace ratelimit with ratelimiter;
which is really similar & already packaged.

I will monitor this effort and switch back pybel to the real
python3-ratelimit if/when it gets in the archive.

Greetings and thank you




----
pybel/debian/patches/ratelimit_is_not_packaged.patch

--- a/src/pybel/manager/citation_utils.py
+++ b/src/pybel/manager/citation_utils.py
@@ -8,7 +8,7 @@
from functools import lru_cache
from typing import Any, Dict, Iterable, List, Mapping, Optional, Set,
Tuple, Union

-import ratelimit
+import ratelimiter
import requests
from more_itertools import chunked
from sqlalchemy import and_
@@ -82,7 +82,7 @@
    return sorted({i for i in _identifiers if i})


-@ratelimit.limits(calls=3, period=1)
+@ratelimiter.RateLimiter(max_calls=3, period=1)
def get_pubmed_citation_response(pubmed_identifiers: Iterable[str]):
    """Get the response from PubMed E-Utils for a given list of PubMed
identifiers.

Le sam. 5 oct. 2024 à 20:33, Ananthu C V <weepingclown@disroot.org> a écrit :
>
> Package: wnpp
> Severity: wishlist
> Owner: Ananthu C V <weepingclown@disroot.org>
> X-Debbugs-Cc: debian-devel@lists.debian.org
>
> It is a dependency for pyflume, a dependency required by
> homeassistant.


Reply to: