Skip to content

Commit ff3ea05

Browse files
authored
Merge pull request #33 from PLAY-behaviorome/0.2.9
Fix bug in download_session_csv.R.
2 parents 67c387b + 2372688 commit ff3ea05

File tree

73 files changed

+1364
-1057
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1364
-1057
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: databraryapi
22
Type: Package
33
Title: Interacts With the Databrary.org API
4-
Version: 0.2.8
4+
Version: 0.2.9
55
Author: Rick O. Gilmore [aut, cre]
66
Authors@R: person("Rick", "O. Gilmore", email = "rog1@psu.edu",
77
role = c("aut", "cre"))

R/download_session_csv.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ download_session_csv <- function(vol_id = 1,
4343

4444
# Main routines
4545
if (vb)
46-
message(paste0("Downloading spreadsheet from volume ", vol_id))
46+
message(paste0("Downloading spreadsheet from volume ", vol_id, '.'))
4747
csv_url <-
4848
paste0("https://nyu.databrary.org/volume/", vol_id, "/csv")
4949

@@ -88,11 +88,15 @@ download_session_csv <- function(vol_id = 1,
8888

8989
#-----------------------------------------------------------------------------
9090
# Old code that kept throwing errors with a small set of volumes, e.g, 34, 1144
91-
# Kept here for legacy purposes.
9291

93-
r <- httr::GET(csv_url)
94-
if (httr::status_code(r) != 200) {
95-
message("GET returns error code ", httr::status_code(r))
92+
r <- try(httr::GET(csv_url), silent = TRUE)
93+
94+
if ((class(r) == 'try-error')) {
95+
if (vb) message ("`try-error` probably due to apostrophe bug in API.")
96+
return(NULL)
97+
}
98+
if ((httr::status_code(r) != 200) | (class(r) == 'try-error')) {
99+
if (vb) message("GET returns error")
96100
NULL
97101
} else {
98102
if (return_response) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Full package documentation built using `pkgdown` can be found [here](https://PLA
1111
- Install the `devtools` package from CRAN: `install.packages("devtools")` if you have not already done so.
1212
- Load `devtools` into your local environment: `library(devtools)`
1313
- Install the `databraryapi` package via `install_github("PLAY-behaviorome/databraryapi")`. Required dependencies will be installed at this time.
14-
- The latest version is 0.2.8.
14+
- The latest version is 0.2.9.
1515

1616
## Use
1717

docs/404.html

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE-text.html

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/databrary-vignette.html

Lines changed: 353 additions & 340 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/index.html

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/authors.html

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)