New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make core QgsNetworkAccessManager more user/python friendly #123

rduivenvoorde opened this Issue Apr 20, 2018 · 2 comments


None yet
2 participants

rduivenvoorde commented Apr 20, 2018

QGIS Enhancement: Title

Date 2018/04/19

Author Richard Duivenvoorde (@rduivenvoorde)


maintainer @user

Version QGIS 3.x


Currently developers (both py and cpp) can use QgsNetworkAccessManager to do their network related actions:

It is a very thin wrapper around QtNetworkAccessManager

If I'm correct, the Qgs-version adds:

  • working with QGIS proxy settings
  • adding singleton'ness
  • manage authentication

Python plugin developers, often use other Network related libraries to do requests to webservices (modules like http2, requests etc). Thereby often 'forgetting' about proxies and QGIS-own authentication framework.

Alessandro/Boundless for QGIS2 introduced a Python NetworkAccessManager, mimicking the http2 api:

While this module mostly works in QGIS3 too, I think it is nicer to actually add some of these utility methods to core QgsNetworkAccessManager class.

In this way it is natively available for Python developers, and they do not have to depend on external libraries. It also brings (hopefully) the right way of threading to a larger audience (#122 (comment))

Proposed Solution

Some nice to have things:

  • let user choose between a synchronous (blocking) and asynchronous (non-blocking) request (eg handy for locatorfilter implementations (

  • handle Timeouts better (= implement the timers in the class and throw exceptions, instead of have to implement them yourself?)

  • be able to override(!) the settings Timeout (so you can create a fast-timing-out request, while in QGIS Settings you have a Timeout of 60 seconds (OR the other way around)

  • handle redirects properly (see

  • set proper (custom) headers (referrer, User-Agent etc)

  • better reporting of exceptions (maybe better mapping of the Qt-exception numbers?)

  • have api for handling the QgsAuthenticationManager (maybe even a way for handling/showing the authentication dialogs?)

  • maybe resembling/learning api from Requests or Http2 modules

  • proper python bindings, tests and documentation


See for example:

And the boundless NAM

Performance Implications


Backwards Compatibility





This comment has been minimized.

luipir commented Apr 20, 2018

@rduivenvoorde may you explain "have api for handling the QgsAuthenticationManager (maybe even a way for handling/showing the authentication dialogs?)"


This comment has been minimized.


rduivenvoorde commented Apr 20, 2018

@luipir I was thinking about showing the widgets (if not set yet), like asking for a master password, or just asking for a password. Though that probably should not be the responsibiliy of QgsNetworkAccessManager

rduivenvoorde referenced this issue in qgis/QGIS Jun 15, 2018

Merge pull request #7055 from m-kuhn/wfsNoMainThreadEventLoopb
Avoid running QEventLoop on main thread (in WFS provider)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment