Skip to content

Commit

Permalink
Add more details to API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Sep 4, 2021
1 parent f246de8 commit 6e0efa2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 8 additions & 2 deletions docs/reference.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
API Reference
=============
.. autoclass:: requests_ratelimiter.requests_ratelimiter.LimiterMixin

.. automodule:: requests_ratelimiter.requests_ratelimiter
.. autoclass:: requests_ratelimiter.requests_ratelimiter.LimiterSession
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

.. autoclass:: requests_ratelimiter.requests_ratelimiter.LimiterAdapter
:members:
:show-inheritance:
:inherited-members:
16 changes: 13 additions & 3 deletions requests_ratelimiter/requests_ratelimiter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Type
from typing import TYPE_CHECKING, Dict, Type
from urllib.parse import urlparse
from uuid import uuid4

Expand All @@ -15,13 +15,23 @@


class LimiterMixin(MixinBase):
"""Mixin class that adds rate-limiting behavior to requests"""
"""Mixin class that adds rate-limiting behavior to requests.
The following parameters also apply to :py:class:`.LimiterSession` and
:py:class:`.LimiterAdapter`.
Args:
rates: One or more request rates
bucket_class: Bucket backend class; either ``MemoryQueueBucket`` (default) or ``RedisBucket``
bucket_kwargs: Bucket backend keyword arguments
per_host: Track request rate limits separately for each host
"""

def __init__(
self,
*rates: RequestRate,
bucket_class: Type[AbstractBucket] = MemoryQueueBucket,
bucket_kwargs=None,
bucket_kwargs: Dict = None,
per_host: bool = False,
**kwargs,
):
Expand Down

0 comments on commit 6e0efa2

Please sign in to comment.