requests get IP from httpbin - JSON
import requests
res = requests.get('http://httpbin.org/ip')
print(res.headers['content-type'])
print(res.text)
print()
data = res.json()
print(data)
print()
print(data['origin'])
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
import requests
res = requests.get('http://httpbin.org/ip')
print(res.headers['content-type'])
print(res.text)
print()
data = res.json()
print(data)
print()
print(data['origin'])