Python API for connecting to Veeam Backup RESTful API service.
Very much an unfinished product right now, only finished as far as I needed it.
$ python setup.py install
v = VeeamSession(
username='secret',
password='secret',
)
v.session_id
The library will mostly return XML Element objects. Like here where you see all the current logon sessions.
for session in v.logonSessions:
print(session.find('veeam:UserName', v._ns).text)
print(session.find('veeam:SessionId', v._ns).text)
The Veeam API requires an XML namespace that is hard coded and defined as 'veeam' in this library. Use v.namespace to reference it.
You can also define your own prefix for the namespace.
v = VeeamSession(
namespace='Veeam'
)
With the basic Enterprise license you won't be able to access all the API features documented.
Get a list of the ones you can access.
session = v.logonSession
for link in session.find('veeam:Links', v.namespace):
print(link.attrib.get('Href'))
The logon_paths property shows a list of those paths that you can match against to see why you might be getting 403 access denied.
See the list_job_statistics.py file in tests/ that lists the current job statistics of all backup servers.
Use repl.py for simple debugging, for example:
$ ipython -i -- repl.py --config client.cfg
Lastly read the source, veeamclient.py should be pretty self-explanatory to python users.