ProtoLife / daptics-api

API documentation and clients for the daptics.ai design of experiments engine
https://daptics.ai
GNU General Public License v3.0
1 stars 1 forks source link

verify_ssl_certificates key error #41

Closed nhpackard closed 2 years ago

nhpackard commented 2 years ago

in both dev and main branches, daptics.connect() yields:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-4-9bdca8fbd813> in <module>
      4 # GraphQL schema.
      5 
----> 6 daptics.connect()

~/Projects/daptics-api/python_client/daptics_client/daptics_client.py in connect(self)
   1056                 auth=self.auth,
   1057                 use_json=True,
-> 1058                 verify=self.options['verify_ssl_certificates'])
   1059             self.gql = gql.Client(
   1060                 transport=http, fetch_schema_from_transport=True)

KeyError: 'verify_ssl_certificates'
pzingg commented 2 years ago
  1. What script (or notebook) are you running?
  2. What version of daptics_client is being used?

I thought I had fixed this bug in the past month or so, but maybe it hasn’t been merged, or maybe it’s still there…

pzingg commented 2 years ago

Please see if there is a "daptics.conf" configuration file saved in the working directory. Its contents should look something like this:

{
  "host": "http://localhost:4040",
  "user": "user@domain.com",
  "password": "password",
  "verify_ssl_certificates": "false"
}

If it doesn't have the "verify_ssl_certificates" ("true" or "false") in it, that could be causing the problem. Also the development branch has this in daptics_client.py, in the _load_config_file method. See if your version has it:

                    for optname in self.DEFAULT_OPTIONS.keys():
                        optvalue = config.get(optname)
                        if optvalue is not None:
                            self.options[optname] = optvalue
                            print('config_file set option {0} to \'{1}\''.format(optname, optvalue))
nhpackard commented 2 years ago
    def _load_config_file(self, config_path, config_must_exist):
        if os.path.exists(config_path):
            try:
                with open(config_path) as f:
                    config = json.load(f)
                    self.config = config_path
                    if self.host is None:
                        self.host = config.get('host')
                    if self.credentials is None:
                        username = config.get('user')
                        password = config.get('password')
                        if username and password:
                            self.credentials = (username, password)
                    for optname in self.options.keys():
                        self.options[optname] = config.get(optname, self.options[optname])
                    return True
            except:
                raise InvalidConfigError(config_path)
        elif config_must_exist:
            raise MissingConfigError(config_path)
        return False
nhpackard commented 2 years ago

git tells me last time daptics_client.py was changed (in dev branch) was

commit c421fc8382729c518aeab9390ad69041d4e96809 (origin/v0.12.0)

maybe your _load_config_file() version is in another branch?

nhpackard commented 2 years ago

Fixed by recent work on rservex.