PenningLabs / lxconsole

LXD Graphical Web Console
GNU Affero General Public License v3.0
161 stars 19 forks source link

requests.get do not use proxies #27

Open baiomys opened 2 months ago

baiomys commented 2 months ago

It seems that proxy field not handled at all during server connections.

url = 'https://' + addr + ':' + port + '/1.0'

    server_name = ''
    try:
      results = requests.get(url, verify=sslVerify, cert=(clientCrt, clientKey))
      results = results.json()
      if 'environment' in results['metadata'].keys():
        if 'server_name' in results['metadata']['environment'].keys():
          server_name = results['metadata']['environment']['server_name']
      if not server_name:
        return jsonify({"status":"", "error": 'Unable to retrieve server information. The lxconsole certificate may not be trusted by this server.'})
    except requests.exceptions.RequestException as err:
      return jsonify({"status":"", "error": str(err)})