Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Proxy support #10

Closed
sababacash opened this issue Apr 24, 2022 · 2 comments
Closed

Proxy support #10

sababacash opened this issue Apr 24, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@sababacash
Copy link

Идея

.env file :

QIWI-PROXY=login:passwd@192.168.0.1:5500

http.ts or other : 

const PROXY = process.env.QIWI-PROXY || null

then feed the proxy to axios
@sababacash sababacash added the enhancement New feature or request label Apr 24, 2022
@sababacash sababacash changed the title 🌟 Предложение: It woud cost a fortune to have a proxy option at the http module 🌟 Предложение: It would cost a fortune to have a proxy option at the http module Apr 24, 2022
@AlexXanderGrib
Copy link
Owner

AlexXanderGrib commented Apr 24, 2022

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:[email protected]:5500

List of apis, that supports custom agent

import {
  // Since 2.3
  Personal,
  P2P, 
  
  // since 3.0
  Wallet, 
  P2p,
  Detector,
  DetectorCompat
} from "qiwi-sdk"

@sababacash
Copy link
Author

Thanks!

@AlexXanderGrib AlexXanderGrib changed the title 🌟 Предложение: It would cost a fortune to have a proxy option at the http module Proxy support Jul 30, 2022
@AlexXanderGrib AlexXanderGrib pinned this issue Jul 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants