ropensci / crul Goto Github PK
View Code? Open in Web Editor NEWR6 based http client for R (for developers)
Home Page: https://docs.ropensci.org/crul
License: Other
R6 based http client for R (for developers)
Home Page: https://docs.ropensci.org/crul
License: Other
Hi,
I have a use case where I need to set up cookie value when running GET/POST method (for a tmp authentication purpose). Is there a way to do so in this package?
In the documentation about crul::auth()
is said to have all its argument optional.
However, crul::auth(auth = "any)
send back an error
Error in assert(user, "character") :
argument "user" is missing, with no default
it is because crul:::make_up
does a check abour argument user
and pwd
which should not be empty
make_up <- function (user, pwd)
{
assert(user, "character")
assert(pwd, "character")
if (!is.null(user) || !is.null(pwd)) {
return(paste0(user, ":", pwd))
}
NULL
}
It seems that it is expected to be set to NULL
considering the code above the the crul:::cpp
function.
I check : with auth(user = NULL, pwd = NULL, auth = "any")
it is working.
It could be useful if this is explained in the documentation help page or maybe if the arguments are set to NULL
by default.
Either way, I can help with a PR if you want to change thing
and in HttpClient
check again before using webmockr
main use case is when using crul
inside a package, becomes esp. important when e.g., a pkg foo
uses crul
, then another pkg bar
uses foo
, which makes likelihood of arg. collisions more likely
and maybe parse
fix it
good way to eliminate some problems
make sure users know about directly accessing verbs on the object definition .e.g, get()
/post()
raise_for_status
present in examples for the HttpResponse
,
maybe body = FALSE
by default
Hi,
How can I use the async feature with disk
or stream
params for the GET
method?
~~
Regards
When making async requests, responses come back unordered which is fine. However it seems like the associated request objects accessible via $request
are always ordered in the original way.
This means that in case responses do not come back in the same order as the original requests, the associated request of the respective response might be wrong.
Here is a minimal example that sometimes works and sometimes not:
library(crul)
(cc <- Async$new(
urls = c(
'https://httpbin.org/get?a=5',
'https://httpbin.org/get?a=5&b=6',
'https://httpbin.org/ip'
)
))
(res <- cc$get())
# the following line prints all urls of the original request object
print(sapply(res, function(x) x$request$url))
# this prints all response urls
print(sapply(res, function(x) x$url))
# those two values should be equal I assume
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin16.5.0 (64-bit)
Running under: macOS Sierra 10.12.5
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] crul_0.3.6
loaded via a namespace (and not attached):
[1] compiler_3.4.0 R6_2.2.1 tools_3.4.0 withr_1.0.2
[5] rstudioapi_0.6 curl_2.6 memoise_1.1.0 Rcpp_0.12.11
[9] urltools_1.6.0 triebeard_0.3.0 digest_0.6.12 devtools_1.13.1
due to new curl options checker - porobably put that param back
https://github.com/sckott/fauxpas
probably in Suggests though so users optionally use it
Hi.
Many thanks for the nice package.
How can I set a some custom options for the requests? For example user agent and proxy server.
put back in once on CRAN
when users access objects/functions
presumably all
port, scheme, etc.
cause they can be things like stuff things
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.