Skip to content

Commit d284564

Browse files
committed
Add readthedocs documentation.
1 parent f32b779 commit d284564

File tree

10 files changed

+244
-0
lines changed

10 files changed

+244
-0
lines changed

.readthedocs.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
# You can also specify other tool versions:
14+
# nodejs: "19"
15+
# rust: "1.64"
16+
# golang: "1.19"
17+
18+
# Build documentation in the "docs/" directory with Sphinx
19+
sphinx:
20+
configuration: docs/source/conf.py
21+
22+
# Optionally build your docs in additional formats such as PDF and ePub
23+
# formats:
24+
# - pdf
25+
# - epub
26+
27+
# Optional but recommended, declare the Python requirements required
28+
# to build your documentation
29+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
30+
python:
31+
install:
32+
- requirements: docs/requirements.txt

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Defining the exact version will make sure things don't break
2+
sphinx-book-theme==1.0.1
3+
# sphinx-pdj-theme==0.4.0
4+
myst-parser==2.0.0
5+
markdown-it-py==3.0.0
6+
sphinx-copybutton==0.5.2

docs/source/code.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# IP2Proxy R API
2+
3+
## IP2Proxy Class
4+
5+
```{py:function} open(binpath)
6+
Load the IP2Proxy BIN database for lookup.
7+
8+
:param str binpath: (Required) The file path links to IP2Proxy BIN databases.
9+
```
10+
11+
```{py:function} get_all(ip)
12+
Retrieve geolocation information for an IP address.
13+
14+
:param string ip: (Required) The IP address (IPv4 or IPv6).
15+
:return: Returns the geolocation information in array. Refer below table for the fields avaliable in the array
16+
:rtype: array
17+
18+
**RETURN FIELDS**
19+
20+
| Field Name | Description |
21+
| ---------------- | ------------------------------------------------------------ |
22+
| country_short | Two-character country code based on ISO 3166. |
23+
| country_long | Country name based on ISO 3166. |
24+
| region | Region or state name. |
25+
| city | City name. |
26+
| isp | Internet Service Provider or company\'s name. |
27+
| domain | Internet domain name associated with IP address range. |
28+
| usage_type | Usage type classification of ISP or company. |
29+
| asn | Autonomous system number (ASN). |
30+
| as_name | Autonomous system (AS) name. |
31+
| last_seen | Proxy last seen in days. |
32+
| threat | Security threat reported. |
33+
| proxy_type | Type of proxy. |
34+
| provider | Name of VPN provider if available. |
35+
```

docs/source/conf.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
# Read https://www.sphinx-doc.org/en/master/usage/configuration.html for more options available
3+
4+
# -- Project information
5+
6+
project = 'IP2Proxy R'
7+
copyright = '2024, IP2Location'
8+
author = 'IP2Location'
9+
10+
release = '0.1.0'
11+
version = '0.1.0'
12+
13+
# -- General configuration
14+
15+
extensions = [
16+
'sphinx.ext.duration',
17+
'sphinx.ext.doctest',
18+
'myst_parser',
19+
'sphinx_copybutton',
20+
]
21+
22+
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
23+
24+
myst_enable_extensions = [
25+
"colon_fence",
26+
"deflist",
27+
"fieldlist",
28+
]
29+
30+
# https://myst-parser.readthedocs.io/en/latest/configuration.html#setting-html-metadata
31+
myst_html_meta = {
32+
"description": "IP2Proxy R package enables user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.",
33+
"keywords": "IP2Proxy, Proxy, IP location, R",
34+
"google-site-verification": "DeW6mXDyMnMt4i61ZJBNuoADPimo5266DKob7Z7d6i4",
35+
}
36+
37+
# templates_path = ['_templates']
38+
39+
# -- Options for HTML output
40+
41+
html_theme = 'sphinx_book_theme'
42+
43+
html_theme_options = {
44+
"use_edit_page_button": False,
45+
"use_source_button": False,
46+
"use_issues_button": False,
47+
"use_download_button": False,
48+
"use_sidenotes": False,
49+
}
50+
51+
# The name of an image file (relative to this directory) to place at the top
52+
# of the sidebar.
53+
html_logo = 'images/ipl-logo-square-1200.png'
54+
55+
# Favicon
56+
html_favicon = 'images/favicon.ico'
57+
58+
html_title = "IP2Proxy R"
59+
60+
# html_baseurl = "https://ip2proxy-deno.readthedocs.io/en/latest/"

docs/source/images/favicon.ico

14.7 KB
Binary file not shown.
19.8 KB
Loading

docs/source/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# IP2Proxy R package
2+
3+
This library allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
4+
5+
- Free IP2Proxy BIN Data: [https://lite.ip2location.com](https://lite.ip2location.com/)
6+
- Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
7+
8+
## Table of contents
9+
```{eval-rst}
10+
.. toctree::
11+
12+
self
13+
quickstart
14+
code
15+
```

docs/source/quickstart.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Quickstart
2+
3+
## Dependencies
4+
5+
IP2Proxy R package requires IP2Proxy BIN database to function. You may download the BIN database at
6+
7+
- IP2Proxy LITE BIN Data (Free): <https://lite.ip2location.com>
8+
- IP2Proxy Commercial BIN Data (Comprehensive):
9+
<https://www.ip2location.com>
10+
11+
IP2Proxy R package required IP2Proxy Python library to work. In order to install IP2Proxy Python library, you can use the following command:
12+
13+
```Python
14+
pip install IP2Proxy
15+
```
16+
17+
## Installation
18+
19+
1. In your RStudio IDE, type the following command into the console:
20+
21+
```R
22+
install.packages("devtools")
23+
require(devtools)
24+
```
25+
26+
2. After that, install IP2Proxy R package by using the following command: `install_github("ip2location/ip2proxy-r")`
27+
28+
## Sample Codes
29+
30+
### Query geolocation information from BIN database
31+
32+
You can query the geolocation information from the IP2Proxy BIN database as below:
33+
34+
```r
35+
library(ip2proxy)
36+
37+
ip2proxy::open("IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL.BIN")
38+
result = ip2proxy::get_all("8.8.8.8")
39+
print(result)
40+
41+
```

0 commit comments

Comments
 (0)