request-pool
v0.1.4
Published
An intelligent proxy and request manager.
Downloads
2
Maintainers
Readme
RequestPool
Functions
- Automatically get proxies (china area)
- Automatically check proxies
- Automatically choose proxies
- Automatically execute http GET request
- Automatically retry if http error occurs
Basic Usage for varsion 0.1.4
npm install request-pool
import
For javascript:
var RequestPool=require('request-pool')
For javascript, to get intellisense, you have to
var RequestPool=require('request-pool/i')
For typescript:
import {RequestPool} from 'request-pool/i'
Main useage
The format of the address is very important
var RequestPool=require('request-pool/i');
var pool=new RequestPool();
pool.Init(function(handler){
//add a proxy server to proxy list
//format: http://x.x.x.x:x
handler.AddProxy("http://123.123.123.123:8888");
//if you are a lazy programmer
//auto get proxy (china area)
handler.AutoGetProxy();
//execute request
//format: http://x.xxx.x
handler.Get("http://www.baidu.com",function(error,response,body){
//...do some thing
})
});
Basic Usage for version 0.0.2
npm install [email protected]
var RequestPool=require('request-pool')
var pool=new RequestPool()
pool.init(function(get){
get("http://www.baidu.com",function(body){
//do something
console.log(body)
})
})