Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Ensure api requests adhere to 5000 / hr limit #29

@abpoll

Description

@abpoll

Question:
How can I adhere to the 5000 / hr limit with an api request?

I've tried implementing the ratelimit (https://pypi.org/project/ratelimit/) and backoff (https://pypi.org/project/backoff/) packages but get a 429 error.

Here is what the function that calls from the api looks like:

@on_exception(expo, RateLimitException, max_tries=10)
@limits(calls=5000, period=ONE_MINUTE)
def call_fs(fsids, api):
    fs = firststreet.FirstStreet(api)
    depths = fs.probability.get_depth(fsids)

    return depths

I also tried setting calls=500 but the 429 error still is thrown.

I'm guessing the limitation is not being implemented in the call.

Do I have to break out fsids into chunks of <= 5000, get them in fs.probability.get_depths(fsids_5000), time the call, and ensure that a minute passes before the next call?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions