Comments (7)
Played around with httptest
a bit (#410) and it quickly became clear that dealing with the long file paths was going to be a pain. Just sticking with vcr
is going to be loads easier I think.
from webchem.
Thanks @maelle. I did follow the guide to fix non-portable file paths and it just didn't go super smoothly.
https://github.com/ropensci/webchem/pull/410/files#diff-a74e30985354d9f5007abd4f0d76acf8927bbfc2abbfe69a4fc80e11dcbc54d9
There are a lot of different API endpoints that webchem
hits, so I was finding it to be a lot of work. vcr
won't work for all of the functions in webchem
, but it'll be easier to set up. Still deciding which is best.
from webchem.
Hi @Aariq, thanks for looking into this, if you start working on API mocking I'll join in.
What I'm wondering about is the advantage of httptest2
over vcr
. I have some experience with vcr
but no experience with httptest2
. I know vcr
is an rOpensci package, I don't know about httptest2
. Cranlogs counts 11k downloads per month for vcr
, and 1.5k for httptest2
. I'm not against httptest2
but I do remember liking vcr
. Maybe we could discuss this a bit more or implement both for a single webservice each and see which one is easier to maintain over time?
Selecting the API: PubChem and ChemSpider are the slowest (many tests) and for ChemSpider there is also the monthly limit. I think ChemSpider would be the best candidate.
from webchem.
The major downside of httrtest
is that it (by default) creates long folder paths (same as API URL) to store the API snapshots, which CRAN doesn't like. There is additional setup to make it not do that. vcr
just stores all the snapshots in folders that you decide the name of.
from webchem.
First, httptest
is the testing package that goes with the httr
package and httptest2
goes with httr2
. httptest
and vcr
have a very similar interface and functionality—with vcr
, you wrap tests or functions inside of tests with use_cassette()
and with httptest
you wrap them with with_mock_dir()
. Learning httptest
was @maelle's suggestion (#306 (comment)).
from webchem.
if you use httptest and then later switch from httr to httr2, it'll be very easy to switch to httptest2.
from webchem.
@Aariq it's a reasonable choice but if the beginning of each file paths it's the same, you can edit the configuration. (you'd need httptest latest version as the former one had a bug nealrichardson/httptest#82)
- Example: https://github.com/EMODnet/EMODnetWFS/blob/main/inst/httptest/request.R
- Docs: https://enpiar.com/r/httptest/articles/faq.html#how-do-i-fix-non-portable-file-paths
Happy to help if needed, and absolutely no pressure to switch to httptest.
from webchem.
Related Issues (20)
- RI Extraction issue HOT 3
- Release webchem 1.2.0
- Common Chemistry CAS API
- Any way to search by Mass? HOT 4
- extract PubChem section's content HOT 2
- improve reliability of `with_cts()` HOT 2
- error with etox_basic() HOT 1
- ChemIDplus has been retired HOT 4
- nist_ri() fails HOT 5
- Release webchem 1.3.0 HOT 1
- `pan_query()` still broken. Should it be made defunct for v 1.3.0? HOT 5
- is.na > 1 error HOT 5
- Character CID that can't be coerced to numeric in `pc_prop()` results in `NA` output for all CIDs HOT 13
- cir_query doesn't return SMILES string even though it exists in PubChem HOT 2
- Improve input validation HOT 1
- Add vignettes (back?) to pkgdown website HOT 2
- pc_sect and section EPA-IRIS-Informtion HOT 2
- Get_cid pulls many CIDs, some wrong HOT 2
- RepoRT: a comprehensive repository for small molecule retention times
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webchem.