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.

Best practice for large api request? #28

Closed

Description

@abpoll

Question:
What is the best practice for statewide or nationwide api requests? When I passed in a list of statewide FSIDs for Massachusetts (> 2 million properties), I got a 429 error. When I chunk the FSIDs into groups of 50,000, I'm able to get through the large request - I noticed that based on the size of the chunk there is a relationship between the size and the speed of the access. I haven't systematically checked, but chunking by 10,000 seems to save time compared to 50,000 - about 50 more it/s.

This got me thinking that if there's an optimal request size (n) the overall time for large requests could be managed well by requesting data from the api in parallel in jobs that simultaneously request n FSIDs. Would this work? What do you recommend for managing request limits and speed?

Additional Information:
Python Version: 3.6.1

OS: Linux

Activity

  1. added
    question
    on Sep 24, 2020
  2. jrp1113 commented on Sep 24, 2020

    @jrp1113

    @seripap what are your thoughts here?

  3. abpoll commented on Sep 24, 2020

    @abpoll
    Author

    As a follow up, after successfully reading/transforming/writing out 6 MA counties, the server got disconnected & then after trying to reconnect I get a mix of timeout errors and network errors

    Ex 1
    2020-09-24 10:46:08,451 asyncio ERROR Task exception was never retrieved
    future: <Task finished coro=<Http.execute() done, defined at /restricted/project/places/code/user/abpoll/.conda/envs/p_test/lib/python3.6/site-packages/firststreet/http_util.py:65> exception=UnauthorizedError('Network Error 401: Inactive API Key',)>

    Ex 2
    2020-09-24 10:46:08,463 asyncio ERROR Task exception was never retrieved
    future: <Task finished coro=<Http.execute() done, defined at /restricted/project/places/code/user/abpoll/.conda/envs/p_test/lib/python3.6/site-packages/firststreet/http_util.py:65> exception=RateLimitError('Network Error 429: Rate limit exceeded. Limit: 5. Remaining: 0. Reset: 55',)>
    Traceback (most recent call last):

  4. Lyetenth commented on Sep 24, 2020

    @Lyetenth
    Contributor

    Hey @abpoll, I think the issue's been resolved. Please reopen if you don't hear back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions