How to use IP2Proxy with R

People often using R for data analysis. You may seen IP addresses in your data. But you don’t have any further details about the IP addresses. You might want to know if the IP addresses is a proxy IP or not. IP2Proxy is the right tool to help you gather the IP address proxy information. IP2Proxy provides a list of proxy information of the IP address, such as the country, region, city, ISP, proxy type and so on. By getting these information, you can further analyze, for example, are the majority of the IP addresses proxies?

In this article, we will guide you on how to install and use the IP2Proxy R package in R by using RStudio, an open source IDE platform. Using IP2Proxy database, you should able to get the proxy information of the IP addresses.

Requirement

IP2Proxy R package is using the IP2Proxy Python library to query the IP2Proxy database. If you don’t have it installed, you can easily install it by executingpip install ip2proxyin the terminal.

To query the information, the IP2Proxy BIN database is needed. You can get a IP2Proxy BIN database from:

Installation

  1. Install devtools in your RStudio. Launch RStudio, and type the following command in the console:install.packages("devtools")
  2. Load devtools by require(devtools)
  3. In the console, type the command below to install the IP2Proxy R package:install_github("ip2location/ip2proxy-r")

Usage

First, use the following code to load the IP2Proxy BIN database: ip2proxy::open(path_to_your_database)

After that, to query the proxy information of an IP address, you can use the following code:ip2proxy::get_all(ip_address)

To just identify whether an IP address is a proxy server or not, you can use the following code:ip2proxy::is_proxy(ip_address)

 

Was this article helpful?

Related Articles