Created
August 26, 2014 10:36
-
-
Save aojea/36e5de369f72778c1a8d to your computer and use it in GitHub Desktop.
R functions to use the RIPEStat API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("jsonlite") | |
# Function that returns the country code of a IP address | |
geoloc<-function(x){ | |
return(fromJSON(paste0("https://stat.ripe.net/data/geoloc/data.json?resource=",x))$data$locations$country) | |
} | |
# Function that returns the ASN of a IP address | |
getasn<-function(x){ | |
return(fromJSON(paste0("https://stat.ripe.net/data/network-info/data.json?resource=",x))$data$asns[1]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment