Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get city name from IP

import re
import json
from urllib2 import urlopen

url = 'http://ipinfo.io/json'
response = urlopen(url)
data = json.load(response)

IP=data['ip']
org=data['org']
city = data['city']
country=data['country']
region=data['region']

print 'Your IP detail
 '
print 'IP : {4} 
Region : {1} 
Country : {2} 
City : {3} 
Org : {0}'.format(org,region,country,city,IP)
Comment

PREVIOUS NEXT
Code Example
Python :: python compare two json objects and get difference 
Python :: random permutation python 
Python :: start django project 
Python :: # find the common elements in the list. 
Python :: arctan in python 
Python :: read bytes from file python 
Python :: frequency of occurrence of that element in the list and the positions 
Python :: py-trello add card 
Python :: how to convert 24 hours to 12 hours in python 
Python :: list to string python 
Python :: fastest way to output text file in python + Cout 
Python :: python requests get cookies 
Python :: remove consecutive duplicates python 
Python :: adaptive thresholding with opencv python 
Python :: plot pandas figsize 
Python :: alarm when code finishes 
Python :: how to check if a message includes a word discord.py 
Python :: django update increment 
Python :: fetch python 
Python :: concat dictionary of dataframes 
Python :: python pyautogui screenshot 
Python :: django not saving images forms 
Python :: mirror 2d numpy array 
Python :: python make api request 
Python :: python intersection of two lists 
Python :: import python module from another directory 
Python :: python get news headlines 
Python :: cosine similarity python numpy 
Python :: how to Take Matrix input from user in Python 
Python :: read text from a pdffile python 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =