From 95ac0a861a69a1697dc679df4d7986b784682c23 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 01:43:58 +0200 Subject: [PATCH 1/5] Creado archivo para script que obtiene IP --- Internet/Obtener_mi_ip.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Internet/Obtener_mi_ip.py diff --git a/Internet/Obtener_mi_ip.py b/Internet/Obtener_mi_ip.py new file mode 100644 index 0000000..e69de29 From acd81443f8f0e864ce4c3e75574d163a70ca9128 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 01:44:48 +0200 Subject: [PATCH 2/5] =?UTF-8?q?A=C3=B1adida=20estructura=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Internet/Obtener_mi_ip.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Internet/Obtener_mi_ip.py b/Internet/Obtener_mi_ip.py index e69de29..f14428d 100644 --- a/Internet/Obtener_mi_ip.py +++ b/Internet/Obtener_mi_ip.py @@ -0,0 +1,14 @@ +#!/usr/bin/python +# -*- encoding: utf-8 -*- + +####################################### +# ### Raúl Caro Pastorino ### # +## ## ## ## +### # https://github.com/fryntiz/ # ### +## ## ## ## +# ### www.fryntiz.es ### # +####################################### + +############################## +## Variables ## +############################## From aa4188ebd68ea6a1a3c12d83f3ffedc781d42d2d Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 01:45:03 +0200 Subject: [PATCH 3/5] =?UTF-8?q?A=C3=B1adida=20descripci=C3=B3n=20del=20scr?= =?UTF-8?q?ipt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Internet/Obtener_mi_ip.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Internet/Obtener_mi_ip.py b/Internet/Obtener_mi_ip.py index f14428d..04940dc 100644 --- a/Internet/Obtener_mi_ip.py +++ b/Internet/Obtener_mi_ip.py @@ -9,6 +9,8 @@ # ### www.fryntiz.es ### # ####################################### +# Este script obtiene la dirección IP del equipo que la ejecuta + ############################## ## Variables ## ############################## From ba373337145c3f4efcfb2477dae0c9b1ca180200 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 01:53:14 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Perfil=20de=20configuraci=C3=B3n=20ninja=20?= =?UTF-8?q?ide=20a=C3=B1adido=20a=20ignorar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..48c0738 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/python.nja From 76010a6560332964149114019e1c279a4efe9795 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 02:54:24 +0200 Subject: [PATCH 5/5] Creado script para obtener la IP --- Internet/Obtener_mi_ip.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Internet/Obtener_mi_ip.py b/Internet/Obtener_mi_ip.py index 04940dc..809e8ac 100644 --- a/Internet/Obtener_mi_ip.py +++ b/Internet/Obtener_mi_ip.py @@ -12,5 +12,24 @@ # Este script obtiene la dirección IP del equipo que la ejecuta ############################## -## Variables ## +## LIBRERÍAS ## ############################## +import urllib2 # Librería para obtener web + +def mi_ip(): + # Variable donde guardar la dirección IP + ip = '' + + # Añadir web html a variable + web = urllib2.urlopen('http://checkip.dyndns.org').read() + + # Recorrer html descargado en busca de números que conforman la ip + for line in str(web): + # Extraer números y puntos separadores + if line in str(range(10)) + '.': + ip += line + + print ('La ip es → ' + ip.strip()) + return ip.strip() + +print(mi_ip())