ip2vn
SDK Python chính thức của IP2.VN — điều khiển proxy xoay IP dân
cư Viettel cho bên làm tool tích hợp. Không phụ thuộc thư viện ngoài (chỉ dùng
urllib chuẩn), cần Python 3.8+.
pip install ip2vn
Mô hình giới thiệu (hoa hồng 10%)
Tool của bạn nhúng mã giới thiệu công khai của bạn và đưa người dùng đăng ký
qua IP2.ref_link('MÃ'). Người dùng tự mua proxy, tự tạo key theo từng cổng
rồi dán vào tool; bạn ăn 10% chi tiêu của họ.
An toàn: chỉ nhúng mã giới thiệu (công khai). TUYỆT ĐỐI không nhúng key, mật khẩu hay token vào tool phát đi — tool nào cũng bung xem được. Key là của chính người dùng cuối, không phải của bạn.
Dùng
from ip2vn import IP2, IP2Error
# Link đưa cho người dùng để họ gắn với bạn:
print(IP2.ref_link("MÃ_GIỚI_THIỆU_CỦA_BẠN")) # https://ip2.vn/?ref=...
# Người dùng dán key cổng của họ vào tool của bạn:
cong = IP2("ip2_xxxxxxxxxxxx")
tin = cong.info() # host, port, ip, cooldown, expire_at, ...
kq = cong.rotate() # { ip, previous_ip, took, next_allowed_in }
cong.auto(300) # hẹn tự xoay mỗi 300s (0 để tắt, thấp nhất 180)
ls = cong.history(limit=20)
cong.renew(30) # gia hạn 1/7/30 ngày, trừ ví người dùng
# Chuỗi proxy sẵn dùng (user/pass proxy do người dùng nhập):
px = cong.proxy("u", "p")
print(px["url"]) # http://u:p@host:port
print(px["tho"]) # host:port:u:p
try:
cong.rotate()
except IP2Error as e:
print(e.code, e.message, e.retry_after)
Khoá theo mã giới thiệu (tuỳ chọn)
Muốn tool chỉ chạy cho khách đã đăng ký qua bạn? Truyền ref là mã giới thiệu
của bạn — SDK hỏi máy chủ xem chủ key có phải khách của bạn không, không phải thì
mọi lệnh ném IP2Error code sai_ref:
cong = IP2(key_nguoi_dung, ref="MÃ_GIỚI_THIỆU_CỦA_BẠN")
cong.rotate() # chỉ chạy nếu key thuộc khách bạn giới thiệu
Không truyền ref thì không khoá gì. Lưu ý: đây là khoá mềm — phép kiểm đúng
ở máy chủ, nhưng quyết định khoá nằm trong SDK nên người bẻ khoá tool vẫn qua
được, và chỉ chặn lệnh đi qua SDK, không chặn ai cắm thẳng host:port:user:pass.
Phương thức
| Gọi | Trả về |
|---|---|
info() |
host, port, line, ip, protocol, auto, cooldown, expire_at, rotations |
rotate(wait=True) |
ip, previous_ip, took, next_allowed_in |
auto(giây) |
auto, every, next_at |
history(limit, since) |
total, items[{ip, at}] |
renew(1|7|30) |
days_added, charged, wallet_balance, expire_at |
proxy(username, password, protocol) |
host, port, url, tho |
IP2.ref_link(mã) |
https://ip2.vn/?ref=mã |
Lỗi ném ra IP2Error với .code (máy đọc), .message (tiếng Việt), .status
(HTTP), .retry_after (giây, khi dính cooldown).
Cổng nghe cả HTTP lẫn SOCKS5 trên cùng một port — chọn giao thức chỉ đổi cách viết chuỗi, không đổi port.
MIT © IP2.VN
Metadata
Release files for ip2vn 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ip2vn-1.1.0.tar.gz | 6.3 kB | Without provenance | Details for ip2vn-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ip2vn-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for ip2vn-1.1.0-py3-none-any.whl |
Total release size: 13.2 kB
Release files / ip2vn-1.1.0.tar.gz
| Download URL | ip2vn-1.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d2da956d5d5d6a49240d4bc1faca8a496039ea5f1ab03cdf18c2ce351e26538
|
|
BLAKE2b-256 checksum How to use checksums |
63f7e16233ae4cc710ea0deeb1a64c0d3511a9a6d5252e1d0ad4260a4b5e4a4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / ip2vn-1.1.0-py3-none-any.whl
| Download URL | ip2vn-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2e159c881ec71c09f735a707df37b77400e904dfa6fdb8ff7a159256f8d43c9
|
|
BLAKE2b-256 checksum How to use checksums |
a20a9f96f7cdcef8806e78cbb91fad2452a5e13b6d655869ead3e9eae845e5c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for ip2vn 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.