Hi,

I am working to update connection settings through RESTful API, and I am using 
Python3. However, my Python3 requests always failed (specified below), while 
request from curl with the same settings (as I can tell) would succeed. By the 
way, I can create new connection with Python3 requests, with similar setting. 

Could you help to shed some light?

Thank you very much!
 
##### Python3 Code ######
url_to_check = 
"http://GUACAMOLE-ADDRESS:8080/guacamole/api/session/data/postgresql/connections/10?token=4C3B8BD5E258F9A67AB12AA97A778D1E2691973D661D260C83C433897A8E4DB3";
data = {
  "name": "ssh-30",
  "identifier": "10",
  "parentIdentifier": "ROOT",
  "protocol": "ssh",
  "attributes": {
    "max-connections": "5",
    "max-connections-per-user": "5"
  },
  "parameters": {
    "hostname": "10.10.37.33",
    "password": "123456755",
    "port": 25,
    "create-recording-path": "true",
    "enable-sftp": "true",
    "recording-path": "/home/supra/session_records",
    "username": "root"
  }
}

headers = {'Content-Type': 'application/json'}
check_plain = requests.put(url=url_to_check, data=data, headers=headers)
###############

###### Result from python requests ######
{"message":"Unexpected internal error","translatableMessage":{"key":"Unexpected 
internal 
error","variables":null},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
###############


###### curl request, updated successfully ######
#curl -X PUT --header 'Content-Type: application/json' -d '  {
  "name": "ssh-30",
  "identifier": "10",
  "parentIdentifier": "ROOT",
  "protocol": "ssh",
  "attributes": {
    "max-connections": "5",
    "max-connections-per-user": "5"
  },
  "parameters": {
    "hostname": "10.10.37.33",
    "password": "123456755",
    "port": 35,
    "create-recording-path": "true",
    "enable-sftp": "true",
    "recording-path": "/home/supra/session_records",
    "username": "root"
  }
}' 
'http://GUACAMOLE-ADDRESS:8080/guacamole/api/session/data/postgresql/connections/10?token=4C3B8BD5E258F9A67AB12AA97A778D1E2691973D661D260C83C433897A8E4DB3’
###############

Thanks,
Yang
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org
For additional commands, e-mail: user-h...@guacamole.apache.org

Reply via email to