The cause of this is that on Windows a NamedTemporaryFile - which is used to store the pinned certificate - cannot be re-opened, and so the permission error is thrown when the ssl library tries to load the pinned certificate.
Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).
It's possible to work around this by setting delete=False when creating the NamedTemporaryFile, although in that case the temporary file needs to be cleaned up by the code that creates it. I'm happy to provide a PR that does this.
On Windows, atttempting to use the api results in an exception for any call:
The cause of this is that on Windows a
NamedTemporaryFile
- which is used to store the pinned certificate - cannot be re-opened, and so the permission error is thrown when the ssl library tries to load the pinned certificate.From python docs here:
It's possible to work around this by setting
delete=False
when creating the NamedTemporaryFile, although in that case the temporary file needs to be cleaned up by the code that creates it. I'm happy to provide a PR that does this.