Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/python.nja
35 changes: 35 additions & 0 deletions Internet/Obtener_mi_ip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/python
# -*- encoding: utf-8 -*-

#######################################
# ### Raúl Caro Pastorino ### #
## ## ## ##
### # https://github.com/fryntiz/ # ###
## ## ## ##
# ### www.fryntiz.es ### #
#######################################

# Este script obtiene la dirección IP del equipo que la ejecuta

##############################
## 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())