Binary files /tmp/tmpevcz55yu/Wec5_A7EXY/r-cran-crul-1.1.0+dfsg/build/vignette.rds and /tmp/tmpevcz55yu/BlKHJEZxrk/r-cran-crul-1.2.0+dfsg/build/vignette.rds differ diff -Nru r-cran-crul-1.1.0+dfsg/debian/changelog r-cran-crul-1.2.0+dfsg/debian/changelog --- r-cran-crul-1.1.0+dfsg/debian/changelog 2021-09-09 18:45:24.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/debian/changelog 2021-11-24 17:45:59.000000000 +0000 @@ -1,3 +1,17 @@ +r-cran-crul (1.2.0+dfsg-1) unstable; urgency=medium + + * Team upload. + * New upstream version 1.2.0+dfsg + * d/copyright: s/MIT/Expat/ + + -- Nilesh Patra Wed, 24 Nov 2021 23:15:59 +0530 + +r-cran-crul (1.1.0+dfsg-2) UNRELEASED; urgency=medium + + * Disable reprotest + + -- Andreas Tille Fri, 10 Sep 2021 06:44:18 +0200 + r-cran-crul (1.1.0+dfsg-1) unstable; urgency=medium * New upstream version diff -Nru r-cran-crul-1.1.0+dfsg/debian/copyright r-cran-crul-1.2.0+dfsg/debian/copyright --- r-cran-crul-1.1.0+dfsg/debian/copyright 2021-09-09 18:45:24.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/debian/copyright 2021-11-24 17:45:44.000000000 +0000 @@ -6,13 +6,13 @@ Files: * Copyright: 2015-2017 Scott Chamberlain -License: MIT +License: Expat Files: debian/* Copyright: 2017 Andreas Tille -License: MIT +License: Expat -License: MIT +License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including diff -Nru r-cran-crul-1.1.0+dfsg/debian/salsa-ci.yml r-cran-crul-1.2.0+dfsg/debian/salsa-ci.yml --- r-cran-crul-1.1.0+dfsg/debian/salsa-ci.yml 2021-09-09 18:45:24.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/debian/salsa-ci.yml 2021-11-24 17:40:55.000000000 +0000 @@ -2,3 +2,8 @@ include: - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml +# R creates .rdb files and .rds with some randomness. +# https://tests.reproducible-builds.org/debian/issues/unstable/randomness_in_r_rdb_rds_databases_issue.html +# Thus reprotest is disabled here +variables: + SALSA_CI_DISABLE_REPROTEST: 1 diff -Nru r-cran-crul-1.1.0+dfsg/DESCRIPTION r-cran-crul-1.2.0+dfsg/DESCRIPTION --- r-cran-crul-1.1.0+dfsg/DESCRIPTION 2021-02-15 16:10:10.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/DESCRIPTION 2021-11-22 19:10:02.000000000 +0000 @@ -6,7 +6,7 @@ The package name is a play on curl, the widely used command line tool for HTTP, and this package is built on top of the R package 'curl', an interface to 'libcurl' (). -Version: 1.1.0 +Version: 1.2.0 License: MIT + file LICENSE Authors@R: c( person("Scott", "Chamberlain", role = c("aut", "cre"), @@ -24,14 +24,14 @@ Suggests: testthat, roxygen2 (>= 7.1.1), fauxpas (>= 0.1.0), webmockr (>= 0.1.0), knitr, rmarkdown VignetteBuilder: knitr -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 X-schema.org-applicationCategory: Web X-schema.org-keywords: http, https, API, web-services, curl, download, libcurl, async, mocking, caching X-schema.org-isPartOf: https://ropensci.org NeedsCompilation: no -Packaged: 2021-02-08 19:38:26 UTC; sckott +Packaged: 2021-11-22 18:46:12 UTC; sckott Author: Scott Chamberlain [aut, cre] () Maintainer: Scott Chamberlain Repository: CRAN -Date/Publication: 2021-02-15 16:10:10 UTC +Date/Publication: 2021-11-22 19:10:02 UTC diff -Nru r-cran-crul-1.1.0+dfsg/inst/doc/best-practices-api-packages.Rmd r-cran-crul-1.2.0+dfsg/inst/doc/best-practices-api-packages.Rmd --- r-cran-crul-1.1.0+dfsg/inst/doc/best-practices-api-packages.Rmd 2021-02-05 22:32:00.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/inst/doc/best-practices-api-packages.Rmd 2021-08-16 21:05:23.000000000 +0000 @@ -1,7 +1,7 @@ --- title: 5. API package best practices author: Scott Chamberlain -date: "2020-07-09" +date: "2021-08-16" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{5. API package best practices} @@ -20,7 +20,7 @@ In most cases you'll only need to import one thing from `crul`: `HttpClient`. Add crul to `Imports` in your `DESCRIPTION` file, -and ad an entry like `@importFrom crul HttpClient` somewhere in +and add an entry like `@importFrom crul HttpClient` somewhere in your package documentation, for example: ```r diff -Nru r-cran-crul-1.1.0+dfsg/man/AsyncQueue.Rd r-cran-crul-1.2.0+dfsg/man/AsyncQueue.Rd --- r-cran-crul-1.1.0+dfsg/man/AsyncQueue.Rd 2020-07-09 18:24:47.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/man/AsyncQueue.Rd 2021-08-16 21:05:01.000000000 +0000 @@ -6,6 +6,14 @@ \description{ An AsyncQueue client } +\section{R6 classes}{ + +This is an R6 class from the package \pkg{R6}. Find out more +about R6 at \url{https://r6.r-lib.org/}. After creating an instance of an R6 +class (e.g., \code{x <- HttpClient$new(url = "https://httpbin.org")}) you can +access values and methods on the object \code{x}. +} + \examples{ \dontrun{ # Using sleep @@ -35,9 +43,9 @@ # Using requests per minute if (interactive()) { -x="https://raw.githubusercontent.com/ropensci/roregistry/gh-pages/registry_urls.json" +x="https://raw.githubusercontent.com/ropensci/roregistry/gh-pages/registry.json" z <- HttpClient$new(x)$get() -urls <- jsonlite::fromJSON(z$parse("UTF-8"))$git_url +urls <- jsonlite::fromJSON(z$parse("UTF-8"))$packages$url repos = Filter(length, regmatches(urls, gregexpr("ropensci/[A-Za-z]+", urls))) repos = unlist(repos) auth <- list(Authorization = paste("token", Sys.getenv('GITHUB_PAT'))) @@ -81,18 +89,18 @@ \item \href{#method-new}{\code{AsyncQueue$new()}} \item \href{#method-request}{\code{AsyncQueue$request()}} \item \href{#method-responses}{\code{AsyncQueue$responses()}} +\item \href{#method-parse}{\code{AsyncQueue$parse()}} +\item \href{#method-status_code}{\code{AsyncQueue$status_code()}} +\item \href{#method-status}{\code{AsyncQueue$status()}} +\item \href{#method-content}{\code{AsyncQueue$content()}} +\item \href{#method-times}{\code{AsyncQueue$times()}} \item \href{#method-clone}{\code{AsyncQueue$clone()}} } } \if{html}{ -\out{
Inherited methods} +\out{
Inherited methods} \itemize{ -\item \out{}\href{../../crul/html/AsyncVaried.html#method-content}{\code{crul::AsyncVaried$content()}}\out{} -\item \out{}\href{../../crul/html/AsyncVaried.html#method-parse}{\code{crul::AsyncVaried$parse()}}\out{} \item \out{}\href{../../crul/html/AsyncVaried.html#method-requests}{\code{crul::AsyncVaried$requests()}}\out{} -\item \out{}\href{../../crul/html/AsyncVaried.html#method-status}{\code{crul::AsyncVaried$status()}}\out{} -\item \out{}\href{../../crul/html/AsyncVaried.html#method-status_code}{\code{crul::AsyncVaried$status_code()}}\out{} -\item \out{}\href{../../crul/html/AsyncVaried.html#method-times}{\code{crul::AsyncVaried$times()}}\out{} } \out{
} } @@ -186,6 +194,80 @@ } } \if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-parse}{}}} +\subsection{Method \code{parse()}}{ +parse content +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{AsyncQueue$parse(encoding = "UTF-8")}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{encoding}}{(character) the encoding to use in parsing. +default:"UTF-8"} +} +\if{html}{\out{
}} +} +\subsection{Returns}{ +character vector, empty character vector before +requests made +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-status_code}{}}} +\subsection{Method \code{status_code()}}{ +Get HTTP status codes for each response +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{AsyncQueue$status_code()}\if{html}{\out{
}} +} + +\subsection{Returns}{ +numeric vector, empty numeric vector before requests made +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-status}{}}} +\subsection{Method \code{status()}}{ +List HTTP status objects +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{AsyncQueue$status()}\if{html}{\out{
}} +} + +\subsection{Returns}{ +a list of \code{http_code} objects, empty list before requests made +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-content}{}}} +\subsection{Method \code{content()}}{ +Get raw content for each response +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{AsyncQueue$content()}\if{html}{\out{
}} +} + +\subsection{Returns}{ +raw list, empty list before requests made +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-times}{}}} +\subsection{Method \code{times()}}{ +curl request times +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{AsyncQueue$times()}\if{html}{\out{
}} +} + +\subsection{Returns}{ +list of named numeric vectors, empty list before requests made +} +} +\if{html}{\out{
}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-clone}{}}} \subsection{Method \code{clone()}}{ diff -Nru r-cran-crul-1.1.0+dfsg/man/Async.Rd r-cran-crul-1.2.0+dfsg/man/Async.Rd --- r-cran-crul-1.1.0+dfsg/man/Async.Rd 2020-07-09 18:24:47.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/man/Async.Rd 2021-08-16 21:05:01.000000000 +0000 @@ -45,6 +45,14 @@ } } +\section{R6 classes}{ + +This is an R6 class from the package \pkg{R6}. Find out more +about R6 at \url{https://r6.r-lib.org/}. After creating an instance of an R6 +class (e.g., \code{x <- HttpClient$new(url = "https://httpbin.org")}) you can +access values and methods on the object \code{x}. +} + \examples{ \dontrun{ cc <- Async$new( diff -Nru r-cran-crul-1.1.0+dfsg/man/AsyncVaried.Rd r-cran-crul-1.2.0+dfsg/man/AsyncVaried.Rd --- r-cran-crul-1.1.0+dfsg/man/AsyncVaried.Rd 2020-07-09 18:24:47.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/man/AsyncVaried.Rd 2021-11-19 14:55:29.000000000 +0000 @@ -43,6 +43,14 @@ } } +\section{R6 classes}{ + +This is an R6 class from the package \pkg{R6}. Find out more +about R6 at \url{https://r6.r-lib.org/}. After creating an instance of an R6 +class (e.g., \code{x <- HttpClient$new(url = "https://httpbin.org")}) you can +access values and methods on the object \code{x}. +} + \examples{ \dontrun{ # pass in requests via ... @@ -240,6 +248,11 @@ \if{html}{\out{
}}\preformatted{AsyncVaried$responses()}\if{html}{\out{
}} } +\subsection{Details}{ +An S3 print method is used to summarise results. \link{unclass} +the output to see the list, or index to results, e.g., \verb{[1]}, \verb{[1:3]} +} + \subsection{Returns}{ a list of \code{HttpResponse} objects, empty list before requests made diff -Nru r-cran-crul-1.1.0+dfsg/man/HttpClient.Rd r-cran-crul-1.2.0+dfsg/man/HttpClient.Rd --- r-cran-crul-1.1.0+dfsg/man/HttpClient.Rd 2021-02-06 03:40:37.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/man/HttpClient.Rd 2021-11-16 16:21:50.000000000 +0000 @@ -19,6 +19,14 @@ it is returned as \code{request_headers$User-Agent} so at least accessing it in the request headers is consistent. } +\section{R6 classes}{ + +This is an R6 class from the package \pkg{R6}. Find out more +about R6 at \url{https://r6.r-lib.org/}. After creating an instance of an R6 +class (e.g., \code{x <- HttpClient$new(url = "https://httpbin.org")}) you can +access values and methods on the object \code{x}. +} + \section{handles}{ curl handles are re-used on the level of the connection object, that is, diff -Nru r-cran-crul-1.1.0+dfsg/man/HttpRequest.Rd r-cran-crul-1.2.0+dfsg/man/HttpRequest.Rd --- r-cran-crul-1.1.0+dfsg/man/HttpRequest.Rd 2020-07-09 19:41:05.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/man/HttpRequest.Rd 2021-08-16 21:05:01.000000000 +0000 @@ -20,6 +20,14 @@ See \code{\link[=HttpClient]{HttpClient()}} for information on parameters. } +\section{R6 classes}{ + +This is an R6 class from the package \pkg{R6}. Find out more +about R6 at \url{https://r6.r-lib.org/}. After creating an instance of an R6 +class (e.g., \code{x <- HttpClient$new(url = "https://httpbin.org")}) you can +access values and methods on the object \code{x}. +} + \examples{ \dontrun{ x <- HttpRequest$new(url = "https://httpbin.org/get") diff -Nru r-cran-crul-1.1.0+dfsg/man/HttpResponse.Rd r-cran-crul-1.2.0+dfsg/man/HttpResponse.Rd --- r-cran-crul-1.1.0+dfsg/man/HttpResponse.Rd 2020-06-09 17:46:57.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/man/HttpResponse.Rd 2021-08-16 21:05:01.000000000 +0000 @@ -33,6 +33,14 @@ } } } +\section{R6 classes}{ + +This is an R6 class from the package \pkg{R6}. Find out more +about R6 at \url{https://r6.r-lib.org/}. After creating an instance of an R6 +class (e.g., \code{x <- HttpClient$new(url = "https://httpbin.org")}) you can +access values and methods on the object \code{x}. +} + \examples{ \dontrun{ x <- HttpResponse$new(method = "get", url = "https://httpbin.org") diff -Nru r-cran-crul-1.1.0+dfsg/man/Paginator.Rd r-cran-crul-1.2.0+dfsg/man/Paginator.Rd --- r-cran-crul-1.1.0+dfsg/man/Paginator.Rd 2021-02-06 03:40:37.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/man/Paginator.Rd 2021-08-16 21:05:01.000000000 +0000 @@ -13,6 +13,14 @@ \details{ See \code{\link[=HttpClient]{HttpClient()}} for information on parameters } +\section{R6 classes}{ + +This is an R6 class from the package \pkg{R6}. Find out more +about R6 at \url{https://r6.r-lib.org/}. After creating an instance of an R6 +class (e.g., \code{x <- HttpClient$new(url = "https://httpbin.org")}) you can +access values and methods on the object \code{x}. +} + \section{Methods to paginate}{ diff -Nru r-cran-crul-1.1.0+dfsg/MD5 r-cran-crul-1.2.0+dfsg/MD5 --- r-cran-crul-1.1.0+dfsg/MD5 2021-02-15 16:10:10.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/MD5 2021-11-22 19:10:02.000000000 +0000 @@ -1,13 +1,13 @@ -0a5e6b7d8db6d816945ca1c7d8317f44 *DESCRIPTION +7e2f28236578b7efdb867bebc51eb424 *DESCRIPTION e34152a5351f580b172ee7093ca84124 *LICENSE -f5acfcdd1ec8c63081359d247c646b52 *NAMESPACE -16d13e5f02821ce0269ba1cb09611c9f *NEWS.md -fc2edef24efcf95e309394d0fbd16ca9 *R/async-queue.R -4a436e9ac9d67a0e7d073189bbd62af6 *R/async.R -148e44f30f23463b7cd5b827a617ff0e *R/asyncvaried.R +2cd96c03630039057905209027d10caa *NAMESPACE +7f94f46470f7993bfb47941944ce2af6 *NEWS.md +d09e1f659dd8f21b7650a7519bf43b39 *R/async-queue.R +4b691a42b0c98cc7d5289dd5d44b1b52 *R/async.R +40a71cbf09470af084e1d80b30f511ee *R/asyncvaried.R 0d3cedbe18c0401f95307215f1bdc312 *R/auth.R e43e1313cab9bd7ffe6f2ed6ca34231b *R/body.R -6904d42bbbd3bf596b1de0eb71af795b *R/client.R +b545fc995ecb0ce1d5a6fe0a78ef7dff *R/client.R 026d6b9b216afc98b2eb93cfa3bb1b53 *R/content-types.R e66320a324ca355793ca5fe482290003 *R/cookies.R 208831c8bed3c10823184d79a1e57ba2 *R/crul-package.r @@ -18,43 +18,43 @@ 8fc7ce53450c0f723e3c8d32c04045ee *R/headers.R 5c1c332b5170a4650cbe03d2de207540 *R/hooks.R 692762e7679c69d3fcf8032f51ec5200 *R/http-headers.R -cefe7b3eb72bc867608f1a00ff2d6d23 *R/httprequest.R +33952a6ef02e8fe70533ea5db3cfab53 *R/httprequest.R ab45f9053572d615cf71c06b9eb7bd23 *R/make_url.R 377ff8c75bc5f9cf7a1535d2cba3a82b *R/mocking.R f68e035e1babc2ea0f6c513101226d00 *R/ok.R e364e24bf11e542d04a1f0cfd1523a88 *R/ok_utils.R b542deb0ca7026cd3aca2d6d79d7bcbd *R/onLoad.R -b96d19473f20983ab17a644a755bbd3f *R/paginator.R +797ed125449c7d9552be940a30657bdd *R/paginator.R 34512e8bacf64556c2873640126f1357 *R/progress.R 4bb4c4415e9023112384675f3456c10c *R/proxies.R ff10b92e14e29e606593ff962f732b7a *R/query.R -4bdc866934622f16ca39cef6fa4559ae *R/response.R +7613250a609285504aee8652f0b383fa *R/response.R 22560cdb8b646e641ee5799410991c17 *R/set.R 72195a1b146f3ef484ac5c6cf1939333 *R/upload.R 14c11771d130c3cc4ba9e9f475a2951d *R/use_agent.R 971b4b9e367151f20978e90c129446e7 *R/verbs.R 8ac99ac5b38e5a0c38be1bd16b2101f7 *R/writing-options.R 32c7b3b595c5de995e39dee23c8f1a1b *R/zzz.R -e2e9ca6a25facaa2bb7a7a0fad9d4e2f *build/vignette.rds +f879aedf984f1b359baf7941c920e005 *build/vignette.rds 92ed511036d843731f5a54e74bb4eabb *inst/doc/async.Rmd -d1b4ecb6149d02694e8dfc8c0dfbad93 *inst/doc/async.html -0b2233b19c06b7d65e43ce64dc19bf95 *inst/doc/best-practices-api-packages.Rmd -35239cfc7a3bcefd6f69eb04462a209f *inst/doc/best-practices-api-packages.html +d54542b2990f6d3ae60bbc2416e80f13 *inst/doc/async.html +6c85de8404caa3373209657927cf68d4 *inst/doc/best-practices-api-packages.Rmd +1c1faf9ff4551dfb5965d6cc52f408d4 *inst/doc/best-practices-api-packages.html b219a4a37740569318e1d48f40d7947a *inst/doc/choosing-a-client.Rmd -dc222fed9a41a4505b22e85b156ea0a4 *inst/doc/choosing-a-client.html +4ae1d22e47871e4904b2ae2b87573169 *inst/doc/choosing-a-client.html 68172478dcd503da570b1a8a98106aa8 *inst/doc/crul.Rmd -5c1adc3a44d296dd4970d93c7d2149f5 *inst/doc/crul.html +df0df79a759b68ff8817c40c91f8f0a5 *inst/doc/crul.html ae185fd2bc423e1d0f490b1aeaeab9f1 *inst/doc/curl-options.Rmd -48bf07ee265b9b3d43df825149278e30 *inst/doc/curl-options.html +66337112fddc7828f56519c49eb61cb9 *inst/doc/curl-options.html 3a3b4038c079516a27dbb7d7e13cf9f1 *inst/doc/how-to-use-crul.Rmd -b4e9ce4f2f7b606dd0f9c13b6e31715c *inst/doc/how-to-use-crul.html -5375b008a450bfaef196b8db5b48f915 *man/Async.Rd -66e4d3eab02a2d965f83f052ab5908d1 *man/AsyncQueue.Rd -20c2d2530f6bc7e9cc15acdf3d5a8368 *man/AsyncVaried.Rd -c72d79c12027b99e20b2c0302fc0a147 *man/HttpClient.Rd -28aa5cb8cca806d8e0bb07059cbf11cc *man/HttpRequest.Rd -1a53dbce5f515aac2831980442883feb *man/HttpResponse.Rd -550f6e85f9d3e621cb3f38bd35a3bd23 *man/Paginator.Rd +ac29d6c5bfa3d887d907cfa582592175 *inst/doc/how-to-use-crul.html +da6b6470bf89b0e515d9e270bdc62b8d *man/Async.Rd +248c275543bad942b4c0d5f0fbf5587c *man/AsyncQueue.Rd +4139716c643b903fa403fe750af9a46f *man/AsyncVaried.Rd +58ca0b23610639de0353900842d2942e *man/HttpClient.Rd +08a7a49aa75bfd4222bc95ae158b35f8 *man/HttpRequest.Rd +84a75ec489cd392fee75db7e791cf70b *man/HttpResponse.Rd +5544e88962a4ae34e2191c6503c709b2 *man/Paginator.Rd 55c3fed958ec743c2a98bd885987d0cf *man/auth.Rd 54b87ed2db2ca79a39b762b5c2d942bb *man/content-types.Rd e1c835263bca884f291a5b471f48cceb *man/cookies.Rd @@ -82,9 +82,9 @@ 19e714592285d128a86facfb90ea4f3e *tests/fixtures/41001c1990.nc 9d086d73e3d68be9f055a6103bf7be39 *tests/test-all.R 261e246b4a8014dff7d2990a4f4ed54d *tests/testthat/helper-crul.R -9f6322da5dd012d84ff3009af8f1f58c *tests/testthat/test-async.R -dff3e18e2f52738371f7675f79e718a8 *tests/testthat/test-asyncqueue.R -0849bed9ba9a5849ff55e99107410aa5 *tests/testthat/test-asyncvaried.R +843ad1be1daa50f906b0deed1cf50588 *tests/testthat/test-async.R +850488a6ff567c6bc9d241afe0730dc9 *tests/testthat/test-asyncqueue.R +1fefef53cc20aa78d139fefb28fdb8a1 *tests/testthat/test-asyncvaried.R 02a49febf3553525d3cfe5cae0861381 *tests/testthat/test-auth.R 5a316e36757121541fa616dd5630a76e *tests/testthat/test-client-delete.R 993fb83f6da57a64231d2c0d18e5b584 *tests/testthat/test-client-get.R @@ -101,7 +101,7 @@ d2110c49a612715bb21cb046f5bc5235 *tests/testthat/test-curl_verbose.R 884ff1183dfa2e484f450fb5bfb9f772 *tests/testthat/test-handle.R 6a5d2d94bd8d5688f34a21a752593ad1 *tests/testthat/test-head_parse.R -4f074aae8c6466ae8d647aac59513ad1 *tests/testthat/test-headers.R +12023b56fe8fa04ef0bc92ffd96a8ff2 *tests/testthat/test-headers.R 3fbb4e1d37f81f8ed9a61ffb863a3654 *tests/testthat/test-mocking.R 40f9550208c8dc101f25d8d80dd9b8b4 *tests/testthat/test-ok.R 9963df3300c511b0fc4e39d2fab06774 *tests/testthat/test-paginator.R @@ -117,8 +117,8 @@ 75b717f0833264514f887aafc82da0c5 *tests/testthat/test-utils.R 92ed511036d843731f5a54e74bb4eabb *vignettes/async.Rmd f8a494a7f6f56316eabd349c49bfe25a *vignettes/async.Rmd.og -0b2233b19c06b7d65e43ce64dc19bf95 *vignettes/best-practices-api-packages.Rmd -61794159ea84b19cb0bf7fe2ba8bf5d5 *vignettes/best-practices-api-packages.Rmd.og +6c85de8404caa3373209657927cf68d4 *vignettes/best-practices-api-packages.Rmd +d797bee3ce410aece16286c1b1c628d3 *vignettes/best-practices-api-packages.Rmd.og b219a4a37740569318e1d48f40d7947a *vignettes/choosing-a-client.Rmd 77d1716858dcaf19dda1c8618a165fb0 *vignettes/choosing-a-client.Rmd.og 68172478dcd503da570b1a8a98106aa8 *vignettes/crul.Rmd diff -Nru r-cran-crul-1.1.0+dfsg/NAMESPACE r-cran-crul-1.2.0+dfsg/NAMESPACE --- r-cran-crul-1.1.0+dfsg/NAMESPACE 2021-02-08 18:42:54.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/NAMESPACE 2021-11-19 15:23:05.000000000 +0000 @@ -6,6 +6,7 @@ S3method(ok,HttpClient) S3method(ok,character) S3method(ok,default) +S3method(print,asyncresponses) export(Async) export(AsyncQueue) export(AsyncVaried) diff -Nru r-cran-crul-1.1.0+dfsg/NEWS.md r-cran-crul-1.2.0+dfsg/NEWS.md --- r-cran-crul-1.1.0+dfsg/NEWS.md 2021-02-08 17:46:55.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/NEWS.md 2021-11-20 15:05:08.000000000 +0000 @@ -1,3 +1,22 @@ +crul 1.2 +======== + +### DOCUMENTATION + +* fix example in `AsyncQueue` docs (#146) thanks @johnbaums ! +* update `HttpClient` docs to state that it's an R6 class, and give some details on what an R6 class is and links to more info (#155) + +### NEW FEATURES + +* `AsyncQueue` gains methods: `parse`, `status_code`, `status`, `content`, and `times` (#156) +* `$responses()` method now returns an S3 class with an associated print method to prevent printing a lot of results to the screen; print method pritns a summary of results, and at most 10 results, just status code and url (#157) + + +### MINOR IMPROVEMENTS + +* parsing response headers gains a check for whether encoding is valid, and if not tries to set Latin1 encoding, and if that doesn't work, fails out with message (#163) (#164) thanks @FlukeAndFeather + + crul 1.1 ======== diff -Nru r-cran-crul-1.1.0+dfsg/R/async-queue.R r-cran-crul-1.2.0+dfsg/R/async-queue.R --- r-cran-crul-1.1.0+dfsg/R/async-queue.R 2020-07-09 00:05:37.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/R/async-queue.R 2021-08-16 21:05:01.000000000 +0000 @@ -2,6 +2,7 @@ #' @description An AsyncQueue client #' @export #' @family async +#' @template r6 #' @examples \dontrun{ #' # Using sleep #' reqlist <- list( @@ -30,9 +31,9 @@ #' #' # Using requests per minute #' if (interactive()) { -#' x="https://raw.githubusercontent.com/ropensci/roregistry/gh-pages/registry_urls.json" +#' x="https://raw.githubusercontent.com/ropensci/roregistry/gh-pages/registry.json" #' z <- HttpClient$new(x)$get() -#' urls <- jsonlite::fromJSON(z$parse("UTF-8"))$git_url +#' urls <- jsonlite::fromJSON(z$parse("UTF-8"))$packages$url #' repos = Filter(length, regmatches(urls, gregexpr("ropensci/[A-Za-z]+", urls))) #' repos = unlist(repos) #' auth <- list(Authorization = paste("token", Sys.getenv('GITHUB_PAT'))) @@ -110,6 +111,39 @@ #' requests made responses = function() { super$output %||% list() + }, + + #' @description parse content + #' @param encoding (character) the encoding to use in parsing. + #' default:"UTF-8" + #' @return character vector, empty character vector before + #' requests made + parse = function(encoding = "UTF-8") { + vapply(super$output, function(z) z$parse(encoding = encoding), "") + }, + + #' @description Get HTTP status codes for each response + #' @return numeric vector, empty numeric vector before requests made + status_code = function() { + vapply(super$output, function(z) z$status_code, 1) + }, + + #' @description List HTTP status objects + #' @return a list of `http_code` objects, empty list before requests made + status = function() { + lapply(super$output, function(z) z$status_http()) + }, + + #' @description Get raw content for each response + #' @return raw list, empty list before requests made + content = function() { + lapply(super$output, function(z) z$content) + }, + + #' @description curl request times + #' @return list of named numeric vectors, empty list before requests made + times = function() { + lapply(super$output, function(z) z$times) } ), diff -Nru r-cran-crul-1.1.0+dfsg/R/async.R r-cran-crul-1.2.0+dfsg/R/async.R --- r-cran-crul-1.1.0+dfsg/R/async.R 2020-07-08 21:59:51.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/R/async.R 2021-08-16 21:05:01.000000000 +0000 @@ -5,6 +5,7 @@ #' @export #' @family async #' @template async-deets +#' @template r6 #' @param path (character) URL path, appended to the base URL #' @param query (list) query terms, as a named list #' @param disk a path to write to. if NULL (default), memory used. diff -Nru r-cran-crul-1.1.0+dfsg/R/asyncvaried.R r-cran-crul-1.2.0+dfsg/R/asyncvaried.R --- r-cran-crul-1.1.0+dfsg/R/asyncvaried.R 2021-02-05 22:32:00.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/R/asyncvaried.R 2021-11-19 14:58:37.000000000 +0000 @@ -6,6 +6,7 @@ #' @export #' @family async #' @template async-deets +#' @template r6 #' @return An object of class `AsyncVaried` with variables and methods. #' [HttpResponse] objects are returned in the order they are passed in. #' We print the first 10. @@ -170,8 +171,10 @@ #' @description List responses #' @return a list of `HttpResponse` objects, empty list before #' requests made + #' @details An S3 print method is used to summarise results. [unclass] + #' the output to see the list, or index to results, e.g., `[1]`, `[1:3]` responses = function() { - private$output %||% list() + structure(private$output %||% list(), class="asyncresponses") }, #' @description List requests @@ -319,3 +322,13 @@ modified = NA_character_, times = NA_character_, content = charToRaw(x)) } + +#' @export +print.asyncresponses <- function(x, ...) { + cat("async responses", sep="\n") + cat(sprintf("status code - url (N=%s; printing up to 10)", length(x)), sep="\n") + if (length(x) == 0) cat(" empty", sep="\n") + for (i in seq_len(min(c(10, length(x))))) { + cat(sprintf(" %s - %s", x[[i]]$status_code, x[[i]]$url), sep="\n") + } +} diff -Nru r-cran-crul-1.1.0+dfsg/R/client.R r-cran-crul-1.2.0+dfsg/R/client.R --- r-cran-crul-1.1.0+dfsg/R/client.R 2021-02-06 03:29:28.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/R/client.R 2021-11-16 16:31:58.000000000 +0000 @@ -3,6 +3,7 @@ #' #' @export #' @template args +#' @template r6 #' @param path URL path, appended to the base URL #' @param query query terms, as a named list. any numeric values are #' passed through [format()] to prevent larger numbers from being @@ -522,6 +523,10 @@ headers <- list() } else { hh <- rawToChar(resp$headers %||% raw(0)) + if (!validEnc(hh)) { + Encoding(hh) <- "latin1" + if (!validEnc(hh)) stop("Headers aren't encoded in UTF-8 or Latin1") + } if (is.null(hh) || nchar(hh) == 0) { headers <- list() } else { diff -Nru r-cran-crul-1.1.0+dfsg/R/httprequest.R r-cran-crul-1.2.0+dfsg/R/httprequest.R --- r-cran-crul-1.1.0+dfsg/R/httprequest.R 2020-07-09 19:40:38.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/R/httprequest.R 2021-08-16 21:05:01.000000000 +0000 @@ -4,6 +4,7 @@ #' @export #' @family async #' @template args +#' @template r6 #' @param path URL path, appended to the base URL #' @param query query terms, as a named list #' @param body body as an R list diff -Nru r-cran-crul-1.1.0+dfsg/R/paginator.R r-cran-crul-1.2.0+dfsg/R/paginator.R --- r-cran-crul-1.1.0+dfsg/R/paginator.R 2021-02-06 03:40:19.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/R/paginator.R 2021-08-16 21:05:01.000000000 +0000 @@ -4,6 +4,7 @@ #' @description A client to help you paginate #' #' @export +#' @template r6 #' @param path URL path, appended to the base URL #' @param query query terms, as a named list. any numeric values are #' passed through [format()] to prevent larger numbers from being diff -Nru r-cran-crul-1.1.0+dfsg/R/response.R r-cran-crul-1.2.0+dfsg/R/response.R --- r-cran-crul-1.1.0+dfsg/R/response.R 2021-02-05 22:32:00.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/R/response.R 2021-08-16 21:05:01.000000000 +0000 @@ -2,6 +2,7 @@ #' @description Class with methods for handling HTTP responses #' #' @export +#' @template r6 #' @seealso [content-types] #' @details #' **Additional Methods** diff -Nru r-cran-crul-1.1.0+dfsg/tests/testthat/test-asyncqueue.R r-cran-crul-1.2.0+dfsg/tests/testthat/test-asyncqueue.R --- r-cran-crul-1.1.0+dfsg/tests/testthat/test-asyncqueue.R 2020-07-09 00:05:37.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/tests/testthat/test-asyncqueue.R 2021-08-16 21:05:01.000000000 +0000 @@ -19,18 +19,39 @@ expect_null(aa$req_per_min) # before requests - expect_equal(length(aa$content()), 0) - expect_equal(length(aa$status()), 0) - expect_equal(length(aa$status_code()), 0) - expect_equal(length(aa$times()), 0) + expect_length(aa$content(), 0) + expect_length(aa$status(), 0) + expect_length(aa$parse(), 0) + expect_length(aa$status_code(), 0) + expect_length(aa$times(), 0) # after requests aa$request() - expect_equal(length(aa$responses()), 2) + expect_length(aa$responses(), 2) expect_is(aa$responses()[[1]], "HttpResponse") - # expect_equal(length(aa$status()), 2) - # expect_equal(length(aa$status_code()), 2) - # expect_equal(length(aa$times()), 2) + + # parse + txt <- aa$parse() + expect_is(txt, "character") + expect_length(txt, 2) + expect_is(jsonlite::fromJSON(txt[1]), "list") + + # status + expect_length(aa$status(), 2) + expect_is(aa$status()[[1]], "http_code") + + # status codes + expect_length(aa$status_code(), 2) + expect_is(aa$status_code(), "numeric") + expect_equal(aa$status_code()[1], 200) + + # times + expect_length(aa$times(), 2) + expect_is(aa$times()[[1]], "numeric") + + # content + expect_length(aa$content(), 2) + expect_is(aa$content()[[1]], "raw") # response_headers and response_headers_all expect_is(aa$responses()[[1]]$response_headers, "list") @@ -74,16 +95,16 @@ out <- AsyncQueue$new(.list = reqlist, bucket_size = 5, sleep = 3) expect_equal(out$bucket_size, 5) expect_equal(out$sleep, 3) - expect_equal(length(out$responses()), 0) + expect_length(out$responses(), 0) # should take at least 6 seconds: 3 sec sleep * 2 sleep periods z <- system.time(out$request()) expect_gt(z[['elapsed']], 6) # after requests sent off - expect_equal(length(out$requests()), 13) + expect_length(out$requests(), 13) resp <- out$responses() - expect_equal(length(resp), 13) + expect_length(resp, 13) for (i in seq_along(resp)) expect_is(resp[[i]], "HttpResponse") for (i in seq_along(resp)) expect_equal(resp[[i]]$status_code, 200) }) @@ -97,7 +118,7 @@ expect_equal(out$bucket_size, 10) expect_null(out$sleep) expect_equal(out$req_per_min, 10) - expect_equal(length(out$responses()), 0) + expect_length(out$responses(), 0) # FIXME: not doing actual requests as would take 1 min # z <- system.time(out$request()) diff -Nru r-cran-crul-1.1.0+dfsg/tests/testthat/test-async.R r-cran-crul-1.2.0+dfsg/tests/testthat/test-async.R --- r-cran-crul-1.1.0+dfsg/tests/testthat/test-async.R 2020-07-08 22:00:42.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/tests/testthat/test-async.R 2021-11-19 15:21:32.000000000 +0000 @@ -22,7 +22,7 @@ # after calling res <- aa$get() - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_equal(length(res), 2) expect_is(res[[1]], "HttpResponse") expect_is(res[[1]]$request, "HttpRequest") @@ -93,7 +93,7 @@ 'https://google.com')) out <- aa$get() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_equal(out[[1]]$method, "get") @@ -109,7 +109,7 @@ hb('/post'))) out <- aa$post() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_equal(out[[1]]$method, "post") }) @@ -123,7 +123,7 @@ hb('/put'))) out <- aa$put() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_equal(out[[1]]$method, "put") @@ -139,7 +139,7 @@ hb('/patch'))) out <- aa$patch() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_equal(out[[1]]$method, "patch") @@ -155,7 +155,7 @@ hb('/delete'))) out <- aa$delete() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_equal(out[[1]]$method, "delete") @@ -171,7 +171,7 @@ 'https://nytimes.com')) out <- aa$head() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_equal(out[[1]]$method, "head") @@ -186,7 +186,7 @@ 'https://nytimes.com')) out <- aa$verb('get') - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_equal(out[[1]]$method, "get") @@ -203,7 +203,7 @@ hb('/get?c=7'))) out <- aa$get() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_is(out[[3]], "HttpResponse") @@ -233,7 +233,7 @@ # cleanup closeAllConnections() - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(out, "list") expect_is(out[[1]], "character") @@ -252,7 +252,7 @@ # cleanup closeAllConnections() - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(out, "list") expect_is(out[[1]], "character") @@ -272,7 +272,7 @@ # cleanup closeAllConnections() - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(out, "list") expect_is(out[[1]], "character") @@ -292,7 +292,7 @@ # cleanup closeAllConnections() - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(out, "list") expect_is(out[[1]], "character") @@ -312,7 +312,7 @@ # cleanup closeAllConnections() - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(out, "list") expect_is(out[[1]], "character") @@ -377,7 +377,7 @@ conn <- Async$new(urls = urls) res <- conn$get() - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(res[[2]], "HttpResponse") @@ -403,7 +403,7 @@ conn <- Async$new(urls = urls) res <- conn$get(disk = files) - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(res[[2]], "HttpResponse") @@ -440,7 +440,7 @@ conn <- Async$new(urls = urls) res <- conn$get(stream = fun) - expect_is(res, "list") + expect_is(res, "asyncresponses") expect_is(res[[1]], "HttpResponse") expect_is(res[[2]], "HttpResponse") diff -Nru r-cran-crul-1.1.0+dfsg/tests/testthat/test-asyncvaried.R r-cran-crul-1.2.0+dfsg/tests/testthat/test-asyncvaried.R --- r-cran-crul-1.1.0+dfsg/tests/testthat/test-asyncvaried.R 2019-11-15 00:47:08.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/tests/testthat/test-asyncvaried.R 2021-11-19 15:21:43.000000000 +0000 @@ -54,7 +54,7 @@ aa$request() out <- aa$responses() - expect_is(out, "list") + expect_is(out, "asyncresponses") expect_is(out[[1]], "HttpResponse") expect_is(out[[2]], "HttpResponse") expect_is(out[[3]], "HttpResponse") diff -Nru r-cran-crul-1.1.0+dfsg/tests/testthat/test-headers.R r-cran-crul-1.2.0+dfsg/tests/testthat/test-headers.R --- r-cran-crul-1.1.0+dfsg/tests/testthat/test-headers.R 2019-06-13 21:08:44.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/tests/testthat/test-headers.R 2021-11-16 16:33:31.000000000 +0000 @@ -84,3 +84,20 @@ # w/o redirects, only 1 header set expect_equal(length(bb$response_headers_all), 1) }) + +context("headers: non-UTF-8 headers") +test_that("headers - non-UTF-8 headers from Crossref ('link' header)", { + skip_on_cran() + + x <- HttpClient$new(url = 'https://doi.org/10.1126/science.aax9044', + opts = list(followlocation = 1), headers = list(Accept = "application/x-bibtex")) + bb <- x$get() + + # response headers are the final set of headers and are named + expect_is(bb, "HttpResponse") + expect_is(bb$response_headers, "list") + expect_named(bb$response_headers) + + # includes link header + expect_is(bb$response_headers$link, "character") +}) diff -Nru r-cran-crul-1.1.0+dfsg/vignettes/best-practices-api-packages.Rmd r-cran-crul-1.2.0+dfsg/vignettes/best-practices-api-packages.Rmd --- r-cran-crul-1.1.0+dfsg/vignettes/best-practices-api-packages.Rmd 2021-02-05 22:32:00.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/vignettes/best-practices-api-packages.Rmd 2021-08-16 21:05:23.000000000 +0000 @@ -1,7 +1,7 @@ --- title: 5. API package best practices author: Scott Chamberlain -date: "2020-07-09" +date: "2021-08-16" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{5. API package best practices} @@ -20,7 +20,7 @@ In most cases you'll only need to import one thing from `crul`: `HttpClient`. Add crul to `Imports` in your `DESCRIPTION` file, -and ad an entry like `@importFrom crul HttpClient` somewhere in +and add an entry like `@importFrom crul HttpClient` somewhere in your package documentation, for example: ```r diff -Nru r-cran-crul-1.1.0+dfsg/vignettes/best-practices-api-packages.Rmd.og r-cran-crul-1.2.0+dfsg/vignettes/best-practices-api-packages.Rmd.og --- r-cran-crul-1.1.0+dfsg/vignettes/best-practices-api-packages.Rmd.og 2021-02-05 22:32:00.000000000 +0000 +++ r-cran-crul-1.2.0+dfsg/vignettes/best-practices-api-packages.Rmd.og 2021-08-16 21:05:01.000000000 +0000 @@ -20,7 +20,7 @@ In most cases you'll only need to import one thing from `crul`: `HttpClient`. Add crul to `Imports` in your `DESCRIPTION` file, -and ad an entry like `@importFrom crul HttpClient` somewhere in +and add an entry like `@importFrom crul HttpClient` somewhere in your package documentation, for example: ```r