会话

要使用单个代理处理多个请求,只需包含 X-SU-Session-Id 标头以及随机生成的字符串作为会话 ID。该 ID 将与唯一的代理关联,该代理将用于 10 分钟内的所有后续请求。10 分钟过后,将向该特定会话 ID 分配一个新 IP。

curl -k -v -x unblock.smartdaili-china.com:60000 \
-U "USERNAME:PASSWORD" "https://ip.smartproxy.com/" \
-H "X-SU-Session-Id: random123"
import requests

proxies = {
    'http': 'http://USERNAME:[email protected]:60000',
    'https': 'http://USERNAME:[email protected]:60000'
}

headers= {
    'X-SU-Session-Id': 'random123'
}

response = requests.request(
    'GET',
    'https://ip.smartproxy.com/',
    verify=False,
    proxies=proxies,
    headers=headers
)

print(response.text)

import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'

const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';

const agent = createHttpsProxyAgent(
  `http://${username}:${password}@unblock.smartdaili-china.com:60000`
);

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;

const headers = {
  'X-SU-Session-Id': 'random123'
}

const response = await fetch('https://ip.smartproxy.com/', {
  method: 'get',
  headers: headers,
  agent: agent
});

console.log(await response.text());