https://issues.qgis.org/https://issues.qgis.org/favicon.ico2018-02-12T11:20:53ZQGIS Issue TrackingQGIS Application - Bug report #18078: Adding Google Maps with PyQGIS https://issues.qgis.org/issues/18078?journal_id=867072018-02-12T11:20:53ZNyall Dawson
<ul><li><strong>Resolution</strong> set to <i>invalid</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>This works for me:</p>
<pre>
import requests
service_url = "mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}"
service_uri = "type=xyz&zmin=0&zmax=21&url=https://"+requests.utils.quote(service_url)
tms_layer = iface.addRasterLayer(service_uri, "Google Sat", "wms")
</pre>
<p>The difference is that the 'https://' portion of the url is not passed to requests.utils.quote. Possibly something has changed in that method in Python3 which has changed this behavior.</p>
<p>In any case, not a QGIS issue.</p>