Skip to main content

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)

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ip2vn-1.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ip2vn-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file ip2vn-1.0.0.tar.gz.

File metadata

  • Download URL: ip2vn-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for ip2vn-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1e376c49b8948d80d8843dcca8713685cdf4188b4b61abc5eb659c9490f5eeb9
MD5 b7da5b5fe436a3db1684e1053a2b264a
BLAKE2b-256 d12ba492001832d658c4b58f9bc4659028844ee1411195e1fb59a60f19ba0827

See more details on using hashes here.

File details

Details for the file ip2vn-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ip2vn-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for ip2vn-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4d073390c763d7a071b0bc24f56ef2204a89a70ef03c58eeb5ddd9fd95cf5f6
MD5 f6e7533bca9df7eee85ffcd82de16eb3
BLAKE2b-256 437bf77cebe68816c1be687d9220d24864f544cbee3b869d793219bf78cca308

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page