Skip to content

check if file is available at a url #2

@NewGraphEnvironment

Description

@NewGraphEnvironment

need to see how we can give informative error messages if url is incorrectly entered or if there are no files at the urls we are trying to hit

here is a true false start


is_valid_url <- function(url) {
  # Regular expression for a simple URL validation
  pattern <- "^https?://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,}(/\\S*)?$"
  grepl(pattern, url)
}

is_accessible_url <- function(url) {
  response <- httr::HEAD(url)
  status <- httr::status_code(response)
  status == 200
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions