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
评论列表
文章目录