region.py 文件源码

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

项目:x-mario-center 作者: fossasia 项目源码 文件源码
def _get_region_geoclue(self):
        """ return the dict with at least countrycode,country from a geoclue
            provider
        """
        bus = dbus.SessionBus()
        master = bus.get_object(
            'org.freedesktop.Geoclue.Master',
            '/org/freedesktop/Geoclue/Master')
        client = bus.get_object(
            'org.freedesktop.Geoclue.Master', master.Create())
        client.SetRequirements(AccuracyLevel.COUNTRY,   # (i) accuracy_level
                               0,                       # (i) time
                               False,                   # (b) require_updates
                               AllowedResources.ALL)    # (i) allowed_resoures
        # this is crucial
        client.AddressStart()
        # now get the data
        time, address_res, accuracy = client.GetAddress()
        return address_res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号