How can I wrap my code in a Promise?

Franklin Bindels : thanks man, let’s see if that works

Dylan Sather (Pipedream) : yes, I’d recommend giving axios a try. I’d also try starting with just a single HTTP request - the first one you’d like to make against the service - just to reduce the scope of what you’re troubleshooting. axios also accepts an auth object with a username and password, which will base64-encode those values so you don’t have to yourself:

await axios({
  ...
  auth: {
    username: clientID,
    password: clientSecret
  }
})

Franklin Bindels : great!, thanks for the info, I’m not a great programmer I hack things together lol so this helps a lot

Franklin Bindels : yeah just getting the auth token first right

Franklin Bindels : THis could work:

const fetch = require('node-fetch');
const HttpsProxyAgent = require('https-proxy-agent');


(async () => {
    const proxyAgent = new HttpsProxyAgent('http://46.250.171.31:8080');
    const response = await fetch('https://httpbin.org/ip?json', { agent: proxyAgent});
    const body = await response.text();
    console.log(body);
})();

Franklin Bindels : I mean should :")

Franklin Bindels : weird that it doesn’t