“apiipify” Respostas de código

apiipify

# This example requires the requests library be installed.  You can learn more
# about the Requests library here: http://docs.python-requests.org/en/latest/
from requests import get

ip = get('https://api.ipify.org').text
print('My public IP address is: {}'.format(ip))
Upset Unicorn

apiipify

var http = require('http');

http.get({'host': 'api.ipify.org', 'port': 80, 'path': '/'}, function(resp) {
  resp.on('data', function(ip) {
    console.log("My public IP address is: " + ip);
  });
});
Upset Unicorn

apiipify

$ curl 'https://api.ipify.org?format=json'
{"ip":"103.132.173.3"}
Energetic Eland

Procure respostas de código populares por idioma

Procurar outros idiomas de código