Last active
July 12, 2019 16:35
-
-
Save cerealskill/6bedcdf17e3d4b545ac809605b9533d5 to your computer and use it in GitHub Desktop.
Simple script para obtener IP Publica en Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
# GET_IP_PUBLIC_PYTHON_SCRIPT_MACOSX | |
# (Requerimientos) revisar antes de ejecutar: | |
# $ python --version | |
# $ pip --version | |
# $ pip install --user pipenv | |
# $ python -m site --user-base | |
# $ echo "export PATH=$PATH:/Users/bash/Library/Python/3.7/bin" >> ~/.bash_profile | |
# $ source ~/.bash_profile | |
# (Doc) Revisar Documentacion (URL): https://docs.python-guide.org/dev/virtualenvs/#installing-pipenv | |
# $ cd project_folder/ | |
# $ pipenv install requests | |
# PARA EJECUTAR: | |
# $ pipenv run python get_public_ip.py | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
import requests | |
response = requests.get('https://httpbin.org/ip') | |
print('Tu ip es {0}'.format(response.json()['origin'])) | |
Guia para instalar Python
Guia para MacOSX
Guía para instalar PIP y Ambientes Virtuales
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Guía para instalar requests