Problem with https in a Picard plugin

I’m trying to create a plugin that fetches some info from the discogs api.
The script works fine when I’m running it outside of Picard, but when I’m trying to run it as a plugin in Picard I get the following error:
“urllib.error.URLError: urlopen error unknown url type: https"
Is it not possible to use ssl in urllib in Picard? Because it works fine in http but the discogs api demands https.
Thank for any help

As Picard does not use urllib it is quite possible that urllib does not ship with the necessary SSL certificates in the release version. The recommended way to do a HTTP(S) request in Picard plugins is using picard.webservice module.

See other plugins doing network requests, e.g.

https://github.com/metabrainz/picard-plugins/blob/2.0/plugins/fanarttv/init.py#L93

Update: Alternatively you could use PyQt5.QtNetwork directly, but using the webservice module is preferred as it will integrate with Picard and will be shown as a pending network request.

2 Likes