getAd(callback) { rp(url) .then(function(result) { callback(result) }) .catch(function(err) { callback("err") }); }
async cloudReq(options) { const { url, auth, ...restOptions } = options; const authorization = auth || this.preLoadDeployAuth; if (!authorization) { throw new Error('Auth isn\'t set'); } return rp({ headers: { authorization: authorization.auth }, ...restOptions, url: `${authorization.url}/${url(authorization.deploymentId)}`, json: true }); }
const requestResult = await rp(sendOptions); if (think.isEmpty(requestResult)) { return expressInfo;
getData(code, callback) { var codeArr = code.split(","); var textAll = ""; var promiseArr = codeArr.map(function (code) { return rp(url + code); }); Promise .all(promiseArr) .then(function (results) { for (let index = 0; index < results.length; index++) { var arr = results[index].toString().split(",") var yesterday_price = parseFloat(arr[2]); var curr_price = parseFloat(arr[3]); var percentage = (curr_price - yesterday_price) / yesterday_price * 100 var text = curr_price.toFixed(2) + "," + percentage.toFixed(2) + "%"; textAll = textAll + text + "||"; } textAll = textAll.substring(0, textAll.length - 2) callback(textAll) }) .catch(function (e) { }); }
let sessionData = await rp(options); sessionData = JSON.parse(sessionData); if (!sessionData.openid) {
async _scrape(champion, position, gameMode) { const data = await rp({ uri: `${this.base}/overview/${champion.key}${position ? '/' + position : ''}/${gameMode === 'ARAM' ? 'aram' : ''}`.toLowerCase(), transform: body => cheerio.load(body) }); const perks = this.scrapePerks(data, position); const itemsets = Mana.getStore().get('item-sets-enable') ? this.scrapeItemSets(data, champion, position, this.scrapeSkillOrder(data)) : []; const summonerspells = Mana.getStore().get('summoner-spells') ? this.scrapeSummonerSpells(data, champion) : []; const statistics = Mana.getStore().get('statistics') ? {} : {}; return { perks, itemsets, summonerspells, statistics, gameMode }; }
showRepository.addUserTvShow(context.session.name, args.id).then(function (result) { return rp("http://api.tvmaze.com/shows/" + args.id) .then(function (res) { return JSON.parse(res); }); }, function (err) { console.log("err", err); })
const isMore = async aid => { let res = await rp(`http://api.bilibili.com/view?type=jsonp&appkey=8e9fc618fbd41e28&id=${aid}&page=2`); return { cid: JSON.parse(res).cid, title: JSON.parse(res).title } }
// istanbul ignore next async prestocardGetRequest(args) { await this.sleep(100); const defaultArgs = { method: 'GET', uri: args.uri, jar: this.cookieJar, resolveWithFullResponse: true, }; const result = await rp(defaultArgs); return result.body; }
_fetch(url, method, data) { return rp({ method, uri: `${this.baseUrl}${url}`, headers: this.headers, json: true, body: data, }); }
async getSession() { return await rp({ method: 'GET', uri: Mana.base + 'lol-champ-select/v1/session', resolveWithFullResponse: true, json: true }); }
rp(options).then(function (data) { return data.ID; }).catch(function (err) { debuglog('createConsulToken failed: ', err); return null; })
function LoadFileFromTelegram(file_path, uri) { return rp({ method: 'GET', uri: uri+file_path, encoding: null, resolveWithFullResponse: true }); }
constructor(devMode) { super('flux', 'Flu.x'); this.base = 'https://manaflux-server.herokuapp.com/'; if (devMode) rp('http://localhost:8920/').then(() => this.base = 'http://localhost:8920/').catch(() => console.log('[Flu.x] Local server is unavailable.')); }
async setCurrentPage(id) { return await rp({ method: 'PUT', uri: Mana.base + 'lol-perks/v1/currentpage', body: { id }, json: true }); }