Skip to content

Instantly share code, notes, and snippets.

@etzl
Last active Dec 2, 2018
Embed
What would you like to do?
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