Closed sababacash closed 2 years ago
Any api since version 2.3 have a field called agent
. You can set it to make API requests through proxy
Example
import { SocksProxyAgent } from 'socks-proxy-agent';
import { Personal } from 'qiwi-sdk';
const qiwi = new Personal(process.env.QIWI_TOKEN, process.env.QIWI_WALLET);
const agent = new SocksProxyAgent(process.env.PROXY);
qiwi.agent = agent;
// If are using custom agent, qiwi instance can not be disposed by itself.
// So you need to set agent to undefined if you expect a safe disposal
qiwi.agent = undefined;
# .env
QIWI_TOKEN=9060***********************ac0d
QIWI_WALLET=791******31
PROXY=socks://login:passwd@192.168.0.1:5500
List of apis, that supports custom agent
import {
// Since 2.3
Personal,
P2P,
// since 3.0
Wallet,
P2p,
Detector,
DetectorCompat
} from "qiwi-sdk"
Thanks!
Идея