[Qgis-user] Reading Credentials from Authentification Configuration
Luigi Pirelli
luipir at gmail.com
Wed Feb 13 08:31:10 PST 2019
do you mind to user QgsNetwrkAccessManager as described in
https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/authentication.html
or a way to usbstitute request with a wrapper to QgsNetwrkAccessManager as
in:
https://github.com/boundlessgeo/lib-qgis-commons/blob/master/qgiscommons2/network/networkaccessmanager.py
or using last api introduced by Nyall:
https://github.com/qgis/QGIS/pull/8440
and related follow-up
pyqgis coockbook should be updated to these new features
Luigi Pirelli
**************************************************************************************************
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
*
https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
* Hire me: http://goo.gl/BYRQKg
**************************************************************************************************
On Wed, 13 Feb 2019 at 16:08, <Fuenfer-Koenigstein.Benjamin at swm.de> wrote:
> Hi,
>
>
>
> I use the OSM Tools plugin in QGIS3. It uses requests library for
> connecting to a OSM routing API. Unfortunately the plugin does not
> considder proxy settings set in Options->Network. I successfully
> implemented this for credentials set in the ‚Basic‘ section by
>
> s = QSettings()
>
> proxy_user = s.value("proxy/proxyUser","")
>
> proxy_password = s.value("proxy/proxyPassword","")
>
>
>
> But I have problems to do this with proxy settings with authentification
> configuration. What I got so far is:
>
>
>
> a = QgsApplication.authManager()
>
> auth_config = s.value("proxy/authcfg","")
>
> meth = a.availableAuthMethodConfigs()[auth_config]
>
> print(meth.name())
>
>
>
> returns the name of auth config I set for proxy, but I cant read
> credentials from the auth config:
>
>
>
> print(meth.hasConfig('username'),meth.hasConfig('password'))
>
>
>
> returns
>
> False False
>
>
>
> Do I use wrong keys for credentials? Do I have to prompt master password
> for auth db to be able to read config?
>
>
>
> print(a.masterPasswordIsSet(), a.masterPasswordSame('mymasterpassword'))
>
> returns
>
> True True
>
>
>
>
>
> Thanks for any help!
>
>
>
> Regards
>
> Benjamin
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190213/5f317ee7/attachment-0001.html>
More information about the Qgis-user
mailing list