Skip to content

Instantly share code, notes, and snippets.

@olmosleo
Last active July 12, 2019 16:35
Show Gist options
  • Save olmosleo/6bedcdf17e3d4b545ac809605b9533d5 to your computer and use it in GitHub Desktop.
Save olmosleo/6bedcdf17e3d4b545ac809605b9533d5 to your computer and use it in GitHub Desktop.
Simple script para obtener IP Publica en Python
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 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']))
@olmosleo
Copy link
Author

olmosleo commented Jul 12, 2019

@olmosleo
Copy link
Author

olmosleo commented Jul 12, 2019

@olmosleo
Copy link
Author

@olmosleo
Copy link
Author

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