0

I am trying to work with the python library provided by Refinitiv on github. I came across the issue that the code in DS_Response.py [1] uses a deprecated package and I would like to fix the code, so that I could use it without resorting to the usage of the deprecated package wincertstore.

The code in the package uses the following structure:

        #Load windows certificates to a local file
        pf = platform.platform()
        if pf.upper().startswith('WINDOWS'):
            self._loadWinCerts()
        else:
            self.certfile = requests.certs.where()

def _loadWinCerts(self):
    import wincertstore
    cfile = wincertstore.CertFile()
    cfile.addstore('CA')
    cfile.addstore('ROOT')
    cfile.addstore('MY')
    self.certfile = cfile.name
    atexit.register(cfile.close)
    #print(self.certfile.name)

I would like to replace the function _loadWinCerts() with a function using ssl.create_default_context(), but I am not sure how to achieve that and if it would be sufficient to just replace the function with this. There's already an upstream bug, but I don't know if that'll ever get fixed.[2]

[1] https://github.com/DatastreamDSWS/Datastream/blob/master/DS_Response.py

[2] https://github.com/DatastreamDSWS/Datastream/issues/14

hannes101
  • 2,410
  • 1
  • 17
  • 40

0 Answers0