参数说明

参数名称 是否必须 备注 示例
userID 用户ID userID-xxx
orderid 订单ID orderid-xxx
region 国家/地区代码,any为随机国家。 region-us (美国地区)
sessionID 固定一个IP,范围:10位以下非特殊符号字符串,不传默认随机IP sessionID-11(每次都走11这个通道同一个出口,和sessiontime一起使用)
sessiontime 绑定时间 sessiontime-10 (分钟1-60,和sessionID一起使用)

帐号和密码格式

  • 帐号: userID-xxx-orderid-xxx-region-any
  • 密码: xxxx
  • 代理地址: x.x.x.x:xxxxx

示例

走美国且保持这个出口

curl -x userID-xxx-orderid-xxx-region-us-sessionID-2222-sessiontime-10:xxxx@x.x.x.x:xxxxx "https://ipinfo.io"

走随机国家

curl -x userID-xxx-orderid-xxx-region-any:xxxx@x.x.x.x:xxxxx "https://ipinfo.io"

当日流量查询

http://ali-hw.vpsnb.net/customer/passage/get_open_info?id=xxxx&secret=xxxx

历史流量查询

http://ali-hw.vpsnb.net/customer/passage_used_day/get_open_list?passageId=xxxx&secret=xxxx&sdate=2024-05-01&edate=2024-05-02

使用说明

  • 海外代理必须在海外网络中使用。
  • sessionID是通道,绑定出口用的,优先级大于地区。参数如果不传,或者每次都传不同,则每次请求代理都会随机。

python代码示例:

import requests
from urllib.parse import quote

# 代理配置
PROXY_HOST = "x.x.x.x"  # 替换为实际代理地址
PROXY_PORT = "xxxxx"    # 替换为实际代理端口
USER_ID = "userID-xxx"  # 替换为您的用户ID
ORDER_ID = "orderid-xxx"  # 替换为您的订单ID
PROXY_PASSWORD = "xxxx"  # 替换为您的密码

def get_random_global_proxy():
    """
    获取随机全球代理(每次请求使用不同出口IP)
    """
    # 构建代理用户名(全球随机)
    username = f"{USER_ID}-{ORDER_ID}-region-any"

    # URL编码用户名和密码
    encoded_username = quote(username, safe='')
    encoded_password = quote(PROXY_PASSWORD, safe='')

    # 构建代理URL
    proxy_url = f"http://{encoded_username}:{encoded_password}@{PROXY_HOST}:{PROXY_PORT}"

    return {
        'http': proxy_url,
        'https': proxy_url
    }

def get_fixed_country_proxy(country_code="us"):
    """
    获取特定国家代理
    :param country_code: 国家代码,如'us', 'jp', 'uk'等
    """
    username = f"{USER_ID}-{ORDER_ID}-region-{country_code}"
    encoded_username = quote(username, safe='')
    encoded_password = quote(PROXY_PASSWORD, safe='')

    proxy_url = f"http://{encoded_username}:{encoded_password}@{PROXY_HOST}:{PROXY_PORT}"

    return {
        'http': proxy_url,
        'https': proxy_url
    }

def get_fixed_ip_proxy(session_id="11", session_time=10, country_code=None):
    """
    获取固定IP代理
    :param session_id: 通道ID
    :param session_time: 绑定时间(分钟)
    :param country_code: 国家代码,如'us', 'jp', 'uk'等
    """
    if country_code:
        username = f"{USER_ID}-{ORDER_ID}-region-{country_code}-sessionID-{session_id}-sessiontime-{session_time}"
    else:
        username = f"{USER_ID}-{ORDER_ID}-sessionID-{session_id}-sessiontime-{session_time}"

    encoded_username = quote(username, safe='')
    encoded_password = quote(PROXY_PASSWORD, safe='')

    proxy_url = f"http://{encoded_username}:{encoded_password}@{PROXY_HOST}:{PROXY_PORT}"

    return {
        'http': proxy_url,
        'https': proxy_url
    }

# 使用示例
if __name__ == "__main__":
    # 示例1:使用随机全球代理
    proxies = get_random_global_proxy()
    try:
        response = requests.get("https://ipinfo.io", proxies=proxies, timeout=30)
        print(f"随机全球代理 - IP信息: {response.text}")
    except Exception as e:
        print(f"请求失败: {e}")

    # 示例2:使用美国代理
    proxies = get_fixed_country_proxy("us")
    try:
        response = requests.get("https://ipinfo.io", proxies=proxies, timeout=30)
        print(f"美国代理 - IP信息: {response.text}")
    except Exception as e:
        print(f"请求失败: {e}")

    # 示例3:使用固定IP代理(美国,绑定10分钟)
    proxies = get_fixed_ip_proxy(session_id="2222", session_time=10, country_code="us")
    try:
        response = requests.get("https://ipinfo.io", proxies=proxies, timeout=30)
        print(f"固定IP代理 - IP信息: {response.text}")
    except Exception as e:
        print(f"请求失败: {e}")
作者:admin  创建时间:2024-06-06 22:46
最后编辑:admin  更新时间:2025-12-01 15:31