[Spice-devel] python bindings documentation/sample

Marc-André Lureau mlureau at redhat.com
Tue Nov 19 07:06:11 PST 2013



----- Original Message -----
> Hello,
> 
> I installed the python bindings library but I don't see any
> documentation/sample.

The old python bindings should be deprecated soon.

You should be using the GI bindings.

> I can connect to the server using the python SSL library and the
> connection appears to work but I don't know how to create a spice
> session.
> The Spice GTK C documentation suggests to instantiate SpiceSession GLIB

In short, it is explained in:
http://lists.freedesktop.org/archives/spice-devel/2013-November/015272.html

> object but such object is not available on the python side.

from gi.repository import SpiceClientGLib
dir(SpiceClientGLib) 

[..., 'Session'..]

session = SpiceClientGLib.Session()
session.set_property("host", "hostname")
session.set_property("port", "5900")

GObject.GObject.connect(self.spice_session, "channel-new", channel_cb)
session.connect()

With API reference, some C example code (spicy.c) or virt-manager code, you should be able to find your way.


> 
> Is there some documentation for the python bindings?

In general, the GObject GI bindings are documented using the C API reference, since an object oriented API is easy to translate in various languages. Language introspection capabilities can sometime help too.


More information about the Spice-devel mailing list