wunderground.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:weather.clue 作者: stefandmn 项目源码 文件源码
def geoip(self):
        retry = 0
        query = ''
        while (retry < 6) and (not xbmc.abortRequested):
            query = self.call('geolookup', 'lang:EN', 'autoip', self.FORMAT)
            if query != '':
                retry = 6
            else:
                retry += 1
                xbmc.sleep(10000)
                commons.debug('GeoIP download failed')
        commons.debug('GeoIP data: %s' % query)
        data = self._parse(query)
        if data is not None and data.has_key('location'):
            location = data['location']['city']
            locationid = data['location']['l'][3:]
            xbmcaddon.Addon().setSetting('Location1', location)
            xbmcaddon.Addon().setSetting('Location1id', locationid)
            commons.debug('Detected GeoIP location: %s' % location)
        else:
            location = ''
            locationid = ''
        return location, locationid
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号