Esempio n. 1
0
File: api.py Progetto: Pacrky/lib
def getLocationByIP(IP):
    """
        get location information based on IP. Using Taobao API
    """
    url = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % (IP)
    print url
    respose = net.getHTMLContent(url)
    return respose
Esempio n. 2
0
File: api.py Progetto: Pacrky/lib
def getLocationByIP(IP):
    """
        get location information based on IP. Using Taobao API
    """
    url = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % (IP)
    print url
    respose = net.getHTMLContent(url)
    return respose
Esempio n. 3
0
File: api.py Progetto: Pacrky/lib
 def getGeoInfo(self):
     """
         get geo information from apis, return a dict about the location
             Input: IP address
             Output: geo info based on ip-services
     """
     for url in [self.freegeoip_url, self.taobao_url, self.qq_url]:
         respose = net.getHTMLContent(url)
         if respose:
             resposedict = json.loads(respose, encoding="utf-8")
             if url == self.taobao_url:
                 self.results.append(resposedict["data"])
             else:
                 self.results.append(resposedict)
         break
Esempio n. 4
0
File: api.py Progetto: Pacrky/lib
 def getGeoInfo(self):
     """
         get geo information from apis, return a dict about the location
             Input: IP address
             Output: geo info based on ip-services
     """
     for url in [self.freegeoip_url, self.taobao_url, self.qq_url]:
         respose = net.getHTMLContent(url)
         if respose:
             resposedict = json.loads(respose, encoding="utf-8")
             if url == self.taobao_url:
                 self.results.append(resposedict["data"])
             else:
                 self.results.append(resposedict)
         break