如何在Python中获取地理位置线索什么是桌面id参数?

如何在Python中获取地理位置线索什么是桌面id参数?,python,geolocation,gobject-introspection,freedesktop.org,geoclue,Python,Geolocation,Gobject Introspection,Freedesktop.org,Geoclue,我正在尝试使用GeoClueforLinux和Python接口(gir1.2-GeoClue-2.0package)获取位置(lat/lon)。这里的api函数几乎匹配,但我不确定应该发送什么“桌面id”。。。应用程序请求的任何有效的.desktop文件??完整路径或唯一名称 >>> Geoclue.Simple.new.__doc__ 'new(desktop_id:str, accuracy_level:Geoclue.AccuracyLevel, cancellable:

我正在尝试使用GeoClueforLinux和Python接口(
gir1.2-GeoClue-2.0
package)获取位置(lat/lon)。这里的api函数几乎匹配,但我不确定应该发送什么“桌面id”。。。应用程序请求的任何有效的
.desktop
文件??完整路径或唯一名称

>>> Geoclue.Simple.new.__doc__
'new(desktop_id:str, accuracy_level:Geoclue.AccuracyLevel, cancellable:Gio.Cancellable=None, callback:Gio.AsyncReadyCallback=None, user_data=None)'
>>> Geoclue.Simple.new_sync('hi',Geoclue.AccuracyLevel.NEIGHBORHOOD,None)

(process:7691): Geoclue-WARNING **: Error setting property 'DesktopId' on interface org.freedesktop.GeoClue2.Client: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/GeoClue2/Client/2 (g-dbus-error-quark, 19)

(process:7691): Geoclue-WARNING **: Error setting property 'RequestedAccuracyLevel' on interface org.freedesktop.GeoClue2.Client: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/GeoClue2/Client/2 (g-dbus-error-quark, 19)
__main__:1: Warning: g_object_unref: assertion 'object->ref_count > 0' failed
<Geoclue.Simple object at 0x7f4fde2ad8b8 (GClueSimple at 0x1b89340)>
>>> Geoclue.Simple.new_sync('something',Geoclue.AccuracyLevel.NEIGHBORHOOD,None)

但是第一个参数应该是什么?什么是“桌面id”?

虽然我不确定这一参数应该是什么,但我已经在Python中使用了它。有完整的解释


谢谢你写这篇文章…非常方便!
c = Geoclue.Simple.new_sync('something',Geoclue.AccuracyLevel.NEIGHBORHOOD,None)
from gi.repository import Geoclue
clue = Geoclue.Simple.new_sync('something',Geoclue.AccuracyLevel.NEIGHBORHOOD,None)
location = clue.get_location()
print(location.get_property('latitude'), location.get_property('longitude'))