python: Translate C examples into Python and include documentation.
[libguestfs.git] / python / examples / guestfs-python.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 guestfs-python - How to use libguestfs from Python
6
7 =head1 SYNOPSIS
8
9  import guestfs
10  g = guestfs.GuestFS ()
11  g.add_drive_opts ("disk.img", format="raw", readonly=1)
12  g.launch
13
14 =head1 DESCRIPTION
15
16 This manual page documents how to call libguestfs from the Python
17 programming language.  This page just documents the differences from
18 the C API and gives some examples.  If you are not familiar with using
19 libguestfs, you also need to read L<guestfs(3)>.
20
21 =head2 EXCEPTIONS
22
23 Errors from libguestfs functions are mapped into C<RuntimeException>
24 with a single string argument which is the error message.
25
26 =head2 MORE DOCUMENTATION
27
28 Type:
29
30  $ python
31  >>> import guestfs
32  >>> help (guestfs)
33
34 =head1 EXAMPLE 1: CREATE A DISK IMAGE
35
36 @EXAMPLE1@
37
38 =head1 EXAMPLE 2: INSPECT A VIRTUAL MACHINE DISK IMAGE
39
40 @EXAMPLE2@
41
42 =head1 SEE ALSO
43
44 L<guestfs(3)>,
45 L<guestfs-examples(3)>,
46 L<guestfs-ocaml(3)>,
47 L<http://libguestfs.org/>.
48
49 =head1 AUTHORS
50
51 Richard W.M. Jones (C<rjones at redhat dot com>)
52
53 =head1 COPYRIGHT
54
55 Copyright (C) 2010 Red Hat Inc. L<http://libguestfs.org/>
56
57 The examples in this manual page may be freely copied, modified and
58 distributed without any restrictions.
59
60 This library is free software; you can redistribute it and/or
61 modify it under the terms of the GNU Lesser General Public
62 License as published by the Free Software Foundation; either
63 version 2 of the License, or (at your option) any later version.
64
65 This library is distributed in the hope that it will be useful,
66 but WITHOUT ANY WARRANTY; without even the implied warranty of
67 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
68 Lesser General Public License for more details.
69
70 You should have received a copy of the GNU Lesser General Public
71 License along with this library; if not, write to the Free Software
72 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA