EPO_OPS_WRAPPER
v1.2.0
Published
EPO OPS WRAPPER with 1) SYNC requesting, 2) token expiry handler & 3) proxy based request randomization
Downloads
40
Readme
EPO OPS WRAPPER
wrapper for EPO OPS version 3.2 request
FEATURE
- http SYNC requesting using fibers/future
- proxy based request randomization
- automatic token expiry handler
install
with npm do:
npm install EPO_OPS_WRAPPER
usage
for checking IPC=A[q=IC%3DA]
details
var ops = require('EPO_OPS_WRAPPER')();
console.log(ops.request('rest-services/published-data/search?q=IC%3DA'));
require('EPO_OPS_WRAPPER')(opt)
@return APP[Object]
| opt | type | description | | --- | --- | --- | | proxy_list | Array of String | [optional] format http://ip:port OR http://usename:password@ip:port | | timeout | Number | [optional] timeout for http request [default => 1000 * 60] |
var ops = require('EPO_OPS_WRAPPER')({
proxy_list: ['http://ip:port', 'http://usename:password@ip:port'],
timeout: 1000 * 30,
});
.signIn(opt)
for consumer_key & consumer_secret based signIn, all .request()
call after this use access_token if it success
| opt | type | description | | --- | --- | --- | | consumer_key | String | for registered user | | consumer_secret | String | for registered user |
@return true if it success, otherwise null with console.log(error)
{
,,,
access_token: [String],
application_name: [String],
client_id: [String],
'developer.email': '[email protected]',
expires_in: '1200',
issued_at: moment().format('x'),
status: 'approved',
token_type: 'BearerToken',
,,,
}
this package automatically handle access_token expiry
var ops = require('EPO_OPS_WRAPPER')({
proxy_list: ['http://ip:port', 'http://usename:password@ip:port'],
});
console.log(ops.signIn({
consumer_key: '12345',
consumer_secret: '123',
}));
console.log(ops.request('rest-services/published-data/search?q=IC%3DA'));
.request(relative_url, method, form)
EPO OPS service SYNC http request, @return [Object]
| opt | type | description | | --- | --- | --- | | relative_url | String | https://ops.epo.org/3.2/[relative_url] | | method | String | default => GET | | form | Object | for POST data |