I believe it only works on python 2.7. Example code of how it should go:
#!/usr/bin/env python2 import guacapy import logging import urllib3 url = "http://..." passwd = "PASSWORD" user = "USERNAME" # initialize guacamole connection client = guacapy.Guacamole(url, user, passwd, default_datasource='mysql' , verify=False) # get list of connections connections = client.get_connections() # create a template dict # connection template - fill out more or less depending on what you need payload_template = { 'activeConnections': 0, 'attributes': { 'max-connections': '', 'max-connections-per-user': '' }, 'identifier': '', 'name': '', 'parameters': { 'hostname': '', 'username': SSH-USER-NAME, 'port': '22', 'private-key': SSH-KEY, 'enable-sftp': 'true', 'sftp-root-directory': '/home/' + SSH-USER-NAME, 'create-recording-path': 'true' }, 'parentIdentifier': GUACAMOLE-PARENT-ID, 'protocol': 'ssh' } # read a csv file with the data for the new connectios # loop over the file and adjust the template with the data read (name, IP, user, etc...) and post it to the API REST while... : payload_template["name"] = data-from-csv['name'] payload_template["parameters"]["hostname"] = data-from-csv['hostname'] .... # add connection client.add_connection(payload) Sadly I didn't found documentation, but if you look into the source code you'll see all the methods available for the Guacamole Object and it's params needed. On Fri, Aug 31, 2018 at 6:41 PM <[email protected]> wrote: > Is there any documentation for that? I cloned it via git, but when I try > to run setup.py, I get errors saying that I didn’t enter the proper > commands. But I can’t find out WHAT commands I need to enter. > > > > Thanks, > > Harry > > > > *From:* Duarte Rocha <[email protected]> > *Sent:* Friday, August 31, 2018 1:25 PM > *To:* [email protected] > *Subject:* Re: Question about adding connections > > > > HI, > > > > I personally created a couple of python scripts using guacapy, then I > generate a CSV and parse it to create/delete/update the connections and > give users the proper permissions. There may be another tools in other > languages that make use of guacamole REST API. > > > > There ain't that much documentation, but from the guacapy source code > (pschmitt/guacapy) you are able to see the various methods available and > the params needed to perform the operations you need. > > > > Regards, > > > > On Fri, Aug 31, 2018 at 6:07 PM <[email protected]> wrote: > > Yeah, I am. But I don’t really know how the tables are connected, so I > can add a connection, then assign that to user with ID X, then user ID Y, > etc. I assume that’s possible? > > > > Thanks, > > Harry > > > > *From:* Goncalo Rosa <[email protected]> > *Sent:* Friday, August 31, 2018 11:21 AM > *To:* [email protected] > *Subject:* RE: Question about adding connections > > > > Hello Harry, > > > > Are you using MariaDB database to store guacamole data? > > > > If so, you can do it using sql scripts. > > > > Regards, > > > > > > [image: > http://www.v2s.us/wp-content/uploads/2017/11/logo-V2S-V-c%C3%B3pia.png] > > *GONÇALO COELHO ROSA* > > V2S Corporation > > m: > > +351 919 937 124 <919%20937%20124> > > > > > > w: > > *www.*v2s.us e: [email protected] > > > > > > *From:* [email protected] <[email protected]> > *Sent:* Friday, 31 August, 2018 15:58 > *To:* [email protected] > *Subject:* Question about adding connections > > > > We have a server set up that currently has 28 users and 39 connections. > We have a request to add 112 more SSH connections, which will then have to > be added to each user. Is there a way to script this in Guacamole somehow, > either in bash or PHP, to do this easier? I can do it manually, but before > I embarked on this task, I figured I’d ask. > > > Thanks, > > Harry > > > > Harry Devine > > DOT/FAA/AJM-2412 > > Common ARTS Software Development > > Terminal Server (NASDAC) Adminstrator > > Red Hat Certfied System Adminstrator (RHCSA) > > [email protected] > > (609)485-4218 > > Building 300, 3rd Floor, Column L20 (3L20) > > > > -- > > -- > > Duarte Rocha <[email protected]> > > ________________________________________ > > (A)bort, (R)etry, (I)nfluence With Large Hammer? > -- -- Duarte Rocha <[email protected]> ________________________________________ (A)bort, (R)etry, (I)nfluence With Large Hammer?
