getBlackList: Get BlackList

Description Usage Arguments Value See Also Examples

Description

Gets the URL's in the Black List. Returns a data.frame

Usage

1

Arguments

proxy

An object of class "proxy". A proxy object see proxy.

...

Additonal function arguments

Value

Returns a data.frame of black listed urls

See Also

Other bwlist functions: addURLBlackList, clearBlackList, clearWhiteList, getWhiteList, setWhiteList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Not run: 
  # A BMP server is assummed running on port 9090
  prxy <- proxy(bmpPort = 9090L, port = 39500L)
  library(httr)
  # use httr_proxy to configure proxy for httr
  white_list <- prxy %>% getWhiteList
  white_list
  # set an entry in the white list
  prxy %>% setWhiteList(".*r-project\\.org.*", statusCode = 333L)
  white_list <- prxy %>% getWhiteList
  white_list
  # expect passing sites
  rcran <- GET("https://cran.r-project.org/", httr_proxy(prxy))
  rproj <- GET("https://www.r-project.org/", httr_proxy(prxy))
  # expect 333 status code for non matching url
  goog <- GET("https://www.google.com/", httr_proxy(prxy))
  goog$status_code
  
  # clear the white list
  white_list <- prxy %>% 
    clearWhiteList %>% 
    getWhiteList
  length(white_list)
  
  # get the black list
  black_list <- prxy %>% getBlackList
  black_list
  
  # add site to black list
  prxy %>% addURLBlackList(".*r-project\\.org.*", statusCode = 334L)
  goog <- GET("https://www.google.com/", httr_proxy(prxy))
  
  # expect sites to return 334 status code
  rcran <- GET("https://cran.r-project.org/", httr_proxy(prxy))
  rproj <- GET("https://www.r-project.org/", httr_proxy(prxy))
  rcran$status_code
  rproj$status_code
  
  # clear black list
  black_list <- prxy %>% 
    clearBlackList %>% 
    getBlackList
  length(black_list)

  prxy %>% closeProxy

## End(Not run)

johndharrison/bmproxy documentation built on May 19, 2019, 5:13 p.m.