Learn R Programming

sen2r (version 1.2.1)

read_scihub_login: Import / export / check SciHub username and password

Description

Read the SciHub login information (read_scihub_login()), save new username and password (write_scihub_login()) or check their validity (check_scihub_login()). Login information is stored in a file apihub.txt inside the ".sen2r" subfolder of the home directory. This functions allow to read or write this file, and to edit them from inside the GUI.

Usage

read_scihub_login(apihub_path = NA)

check_scihub_login(username, password)

check_scihub_connection()

write_scihub_login(username, password, apihub_path = NA, check = TRUE, append = FALSE)

Arguments

apihub_path

Path of the file in which login information is saved. If NA (default) it is automatically read from the package default location.

username

SciHub username.

password

SciHub password.

check

Logical: if TRUE (default), new credentials are checked before writing them on apihub_path (if they are invalid, an error is provided); if FALSE, they are directly written.

append

Logical: if TRUE, new credentials are added to the ones existing within apihub_path; if FALSE (default), apihub_path is replaced with the new ones.

Value

read_scihub_login returns a matrix of credentials, in which username is in the first column, password in the second.

check_scihub_login returns TRUE if credentials are valid, FALSE elsewhere.

check_scihub_connection returns TRUE if internet connection is available and SciHub is accessible, FALSE otherwise.

write_scihub_login returns NULL.

Examples

Run this code
# NOT RUN {
  check_scihub_login("user", "user")
  write_scihub_login("user", "user")
  read_scihub_login()
  check_scihub_connection()
# }

Run the code above in your browser using DataLab