Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large dataset issues #114

Open
sethmenghi opened this issue Sep 27, 2023 · 0 comments
Open

Large dataset issues #114

sethmenghi opened this issue Sep 27, 2023 · 0 comments

Comments

@sethmenghi
Copy link

When downloading large datasets, there are issues with retrieving the data. Using an AsyncClient solved this issue as the dataretrieval package failed. Here is what was used to fix this issue:

import httpx

import json_stream.httpx

async def get_dataframe(
        url: str,
        location_id: str
    ):):      
      async with httpx.AsyncClient() as client:
            response = await self.get_data(url, request_params, client)
            response.raise_for_status()

            df= self.parse_data(response, merged_df)
            ...

    async def get_data(url, request_params: dict, client):
        """Tenacity retry api calls."""

        _retry = retry(stop=stop_after_attempt(7))
        return await _retry(client.post)(
            url,
            json=request_params,
            follow_redirects=True,
            timeout=None,
        )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant