Skip to content

Instantly share code, notes, and snippets.

@etzl
Last active December 2, 2018 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etzl/33b98cdbcc9b53396e6a27f4297e17ff to your computer and use it in GitHub Desktop.
Save etzl/33b98cdbcc9b53396e6a27f4297e17ff to your computer and use it in GitHub Desktop.
Get public ip and show in terminal using python with no extera package needed
import requests
response = requests.get("https://httpbin.org/ip")
print(response.json()['origin'])
@etzl
Copy link
Author

etzl commented Dec 2, 2018

I was looking for a method i get public IP without browsing internet i found this code with python doing this easy, I'm sharing for those who need it and check help(requests) and help(str) out for more information. 👌

  • Requirements:
    • Download python 3.7 from python website
    • It should come with pip. if not check this out
    • install requests package with pip install requests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment