Browse Source

cleanup & travis

0.6.0
boB Rudis 1 year ago
parent
commit
34023fc086
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
8 changed files with 100 additions and 11 deletions
  1. +2
    -8
      .travis.yml
  2. +6
    -0
      NAMESPACE
  3. +4
    -0
      NEWS.md
  4. +27
    -1
      R/splashr.r
  5. +20
    -0
      R/user-agents.R
  6. +20
    -0
      man/print.splashr.Rd
  7. +6
    -2
      man/splash.Rd
  8. +15
    -0
      man/splash_user_agent.Rd

+ 2
- 8
.travis.yml View File

@@ -9,17 +9,11 @@ services:
env:
global:
- NOT_CRAN=true
matrix:
- PIP="pip" RETICULATE_PYTHON="/usr/bin/python"
- PYTHON=3 PIP="pip3" RETICULATE_PYTHON="/usr/bin/python3"

before_install:
- docker pull scrapinghub/splash:3.0
- docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 -d scrapinghub/splash:3.0
- docker pull scrapinghub/splash:3.2
- docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 -d scrapinghub/splash:3.2
- docker ps -a
- sudo apt-get -y install python${PYTHON}-pip python-dev python${PYTHON}-numpy
- sudo $PIP install -U setuptools
- sudo $PIP install -U docker

r:
- oldrel


+ 6
- 0
NAMESPACE View File

@@ -5,6 +5,7 @@ S3method(as.data.frame,harentries)
S3method(as.data.frame,harentry)
S3method(print,splash_debug)
S3method(print,splash_json)
S3method(print,splashr)
export("%>%")
export(HARviewer)
export(HARviewerOutput)
@@ -77,11 +78,16 @@ export(splash_version)
export(splash_wait)
export(start_splash)
export(stop_splash)
export(ua_android_samsung)
export(ua_apple_tv)
export(ua_chromecast)
export(ua_ios_safari)
export(ua_kindle)
export(ua_linux_chrome)
export(ua_linux_firefox)
export(ua_macos_chrome)
export(ua_macos_safari)
export(ua_ps4)
export(ua_splashr)
export(ua_win10_chrome)
export(ua_win10_firefox)


+ 4
- 0
NEWS.md View File

@@ -2,6 +2,10 @@

* Switch Docker orchestration to the `stevedore` package
* Fixed minor check on as.data.frame functions
* Cleaned up splashr object printing
* Added Android, Kindle, Apple TV & Chromecast user agents and updated
other user agents
* Updated Travis config to not use old docker pkg components

0.5.0



+ 27
- 1
R/splashr.r View File

@@ -2,6 +2,10 @@ splash_url <- function(splash_obj) { sprintf("http://%s:%s", splash_obj$host, sp

#' Configure parameters for connecting to a Splash server
#'
#'
#' @md
#' @note There is a quick "helper" object named `splash_local` which is preconfigured
#' with `localhost` as the host name.
#' @param host host or IP address
#' @param port port the server is running on (default is 8050)
#' @param user,pass leave `NULL` if basic auth is not configured. Otherwise,
@@ -11,7 +15,29 @@ splash_url <- function(splash_obj) { sprintf("http://%s:%s", splash_obj$host, sp
#' sp <- splash()
#' }
splash <- function(host, port=8050L, user=NULL, pass=NULL) {
list(host=host, port=port, user=user, pass=pass)
obj <- list(host=host, port=port, user=user, pass=pass)
class(obj) <- c("splashr", "list")
obj
}

#' Print for splashr
#'
#' @md
#' @param x a splashr object
#' @param ... unused
#' @keywords internal
#' @return x
#' @export
print.splashr <- function(x, ...) {

cat(
"<splashr instance connection; ",
if (length(x$user)) sprintf("%s@", x$user) else "",
x$host, ":", x$port, ">\n", sep=""
)

invisible(x)

}

#' @rdname splash


+ 20
- 0
R/user-agents.R View File

@@ -46,3 +46,23 @@ ua_linux_firefox <- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/2010
#' @rdname splash_user_agent
#' @export
ua_ios_safari <- "Mozilla/5.0 (iPad; CPU OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0 Mobile/14C92 Safari/602.1"

#' @rdname splash_user_agent
#' @export
ua_android_samsung <- "Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36"

#' @rdname splash_user_agent
#' @export
ua_kindle <- "Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+"

#' @rdname splash_user_agent
#' @export
ua_ps4 <- "Mozilla/5.0 (PlayStation 4 3.11) AppleWebKit/537.73 (KHTML, like Gecko)"

#' @rdname splash_user_agent
#' @export
ua_apple_tv <- "AppleTV6,2/11.1"

#' @rdname splash_user_agent
#' @export
ua_chromecast <- "Mozilla/5.0 (CrKey armv7l 1.5.16041) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.0 Safari/537.36"

+ 20
- 0
man/print.splashr.Rd View File

@@ -0,0 +1,20 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/splashr.R
\name{print.splashr}
\alias{print.splashr}
\title{Print for splashr}
\usage{
\method{print}{splashr}(x, ...)
}
\arguments{
\item{x}{a splashr object}

\item{...}{unused}
}
\value{
x
}
\description{
Print for splashr
}
\keyword{internal}

+ 6
- 2
man/splash.Rd View File

@@ -5,7 +5,7 @@
\alias{splash}
\alias{splash_local}
\title{Configure parameters for connecting to a Splash server}
\format{An object of class \code{list} of length 4.}
\format{An object of class \code{splashr} (inherits from \code{list}) of length 4.}
\usage{
splash(host, port = 8050L, user = NULL, pass = NULL)

@@ -16,12 +16,16 @@ splash_local

\item{port}{port the server is running on (default is 8050)}

\item{user, pass}{leave `NULL` if basic auth is not configured. Otherwise,
\item{user, pass}{leave \code{NULL} if basic auth is not configured. Otherwise,
fill in what you need for basic authentication.}
}
\description{
Configure parameters for connecting to a Splash server
}
\note{
There is a quick "helper" object named \code{splash_local} which is preconfigured
with \code{localhost} as the host name.
}
\examples{
\dontrun{
sp <- splash()


+ 15
- 0
man/splash_user_agent.Rd View File

@@ -15,6 +15,11 @@
\alias{ua_linux_chrome}
\alias{ua_linux_firefox}
\alias{ua_ios_safari}
\alias{ua_android_samsung}
\alias{ua_kindle}
\alias{ua_ps4}
\alias{ua_apple_tv}
\alias{ua_chromecast}
\title{Overwrite the User-Agent header for all further requests.}
\format{An object of class \code{character} of length 1.}
\usage{
@@ -43,6 +48,16 @@ ua_linux_chrome
ua_linux_firefox

ua_ios_safari

ua_android_samsung

ua_kindle

ua_ps4

ua_apple_tv

ua_chromecast
}
\arguments{
\item{splash_obj}{splashr object}


Loading…
Cancel
Save