Skip to content
Permalink
Browse files

[pluginmanager] apply auth also when downloading plugin package

  • Loading branch information
alexbruy authored and dakcarto committed Mar 4, 2016
1 parent 2f5c193 commit e2879c358dd6eff9f85b8acd8772c91e644fc88d
Showing with 23 additions and 7 deletions.
  1. +23 −7 python/pyplugin_installer/qgsplugininstallerinstallingdialog.py
@@ -29,10 +29,10 @@
from PyQt4.QtNetwork import QNetworkRequest, QNetworkReply

import qgis
from qgis.core import QgsNetworkAccessManager
from qgis.core import QgsNetworkAccessManager, QgsAuthManager

from ui_qgsplugininstallerinstallingbase import Ui_QgsPluginInstallerInstallingDialogBase
from installer_data import removeDir
from installer_data import removeDir, repositories
from unzip import unzip


@@ -57,11 +57,27 @@ def __init__(self, parent, plugin):
self.file = QFile(tmpPath)

self.request = QNetworkRequest(url)
self.reply = QgsNetworkAccessManager.instance().get(self.request)
self.reply.downloadProgress.connect(self.readProgress)
self.reply.finished.connect(self.requestFinished)

self.stateChanged(4)
authcfg = repositories.all()[plugin["zip_repository"]]["authcfg"]
if authcfg and isinstance(authcfg, basestring):
if not QgsAuthManager.instance().updateNetworkRequest(
self.request, authcfg.strip()):
self.mResult = self.tr(
"Update of network request with authentication "
"credentials FAILED for configuration '{0}'").format(authcfg)
self.request = None

if self.request is not None:
self.reply = QgsNetworkAccessManager.instance().get(self.request)
self.reply.downloadProgress.connect(self.readProgress)
self.reply.finished.connect(self.requestFinished)

self.stateChanged(4)

def exec_(self):
if self.request is None:
return QDialog.Rejected

QDialog.exec_(self)

# ----------------------------------------- #
def result(self):

0 comments on commit e2879c3

Please sign in to comment.
You can’t perform that action at this time.