Se aiuta chiunque ho scritto un breve script per estrarre l'url casuale generato nel nodo:
Rende presupposto siete interessati solo l'url sicuro.
const fetch = require('node-fetch')
fetch('http://localhost:4040/api/tunnels')
.then(res => res.json())
.then(json => json.tunnels.find(tunnel => tunnel.proto === 'https'))
.then(secureTunnel => console.log(secureTunnel.public_url))
.catch(err => {
if (err.code === 'ECONNREFUSED') {
return console.error("Looks like you're not running ngrok.")
}
console.error(err)
})
Se si voleva tutte le gallerie:
const fetch = require('node-fetch')
fetch('http://localhost:4040/api/tunnels')
.then(res => res.json())
.then(json => json.tunnels.map(tunnel => tunnel.public_url))
.then(publicUrls => publicUrls.forEach(url => console.log(url)))
.catch(err => {
if (err.code === 'ECONNREFUSED') {
return console.error(
"Looks like you're not running ngrok."
)
}
console.error(err)
})
fonte
2017-10-05 09:56:00
come posso farlo con python3 con urllib.urlopen solo? Non voglio 1. chiamare il comando esterno curl, 2. reindirizzare a un file..Grazie – f126ck