Use of crul's retry sub-routine in an API package

Tags: #<Tag:0x00007f5171bd1c70>

rOpenSci package or resource used*

e.g. one of our packages, our package development guide book, a Community Call, or a blog post

crul, an HTTP Client by @sckott organized around R6 classes, mostly meant to be a developer-facing HTTP client.

URL or code snippet for your use case*

Link to a blog post, a gist, or an academic paper, or provide some code inline

Sector

List one of: academic / industry / government / non-profit / other

Other

Field(s) of application

e.g. ecology, epidemiology, Antarctic and Southern Ocean research, biomedical research, energy, finance, history, social sciences, anything!

Air quality (exposure science? epidemiology?)

What did you do?

Explain briefly what you did, to pique your readers’ interest

The retry() method in crul::HttpClient replaced my own code for retrying in case of failures in my rOpenSci ropenaq package that provides access to data from OpenAQ API (air quality data).

I had code with a while loop, counting iterations, adding waiting time, etc., and it turns out I didn’t need to! Using the method from crul I’m saving lines of code and the responsability for testing the retrying is at least partly on crul maintainer. :wink:

Comments

e.g. feedback or feature request

Thanks @sckott for telling me about the method. I should read the docs and the changelog more closely!

Twitter handle

if you would like to be tagged in a tweet about your use case

@ma_salmon (but the more general post is via @rhub_).

2 Likes