Skip to main content

Strawberry GraphQL Ratelimit Extension

Installation

pip3 install strawberry-ratelimit

Usage

my_schema = strawberry.Schema(
    query=Query,
    mutation=Mutation,
    extensions=[
        # 60req/min
        ExtensionRatelimit(
            type_name=['getUser', 'updateUser', 'user_friends'], # queries, mutations, internal funcs.
            rate_max=60,
            rate_seconds=60,
            depth_max=50, # Maximum depth of the query
            call_max=500 # Maximum call count
        )
    ]
)

Limitations

  • Consider this project as a reference code. Do not use it for production.

    • Currently, the code uses a single global dict variable to store users' query/mutation accesses.
    • Although there is a code to flush the list of user's IP after a certain amount of logs, the code itself does not collect garbage and it may consume a lot of memory depending on the number of users.
    • It is recommended to re-write this code with DB support for optimization.

Metadata

Release files for strawberry-ratelimit 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strawberry-ratelimit 1.0.1
File Size Uploaded Provenance Actions
strawberry-ratelimit-1.0.1.tar.gz 6.1 kB Without provenance Details for strawberry-ratelimit-1.0.1.tar.gz

Release files / strawberry-ratelimit-1.0.1.tar.gz

Download URL strawberry-ratelimit-1.0.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f54dd6ac032aa94af4557ac5deab2e3a245bf81d71a7a2d0c8faa458672dbff2
BLAKE2b-256 checksum
How to use checksums
0fe6482f33831499065a46f8f325c96729488d75bff8d536e21a2df300d23697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/2.7.18

Security for strawberry-ratelimit 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page