The QNetworkProxyFactory class provides fine-grained proxy selection. More

Inheritance diagram of PySide6.QtNetwork.QNetworkProxyFactory


Virtual functions

Static functions

Detailed Description

QNetworkProxyFactory is an extension to QNetworkProxy , allowing applications to have a more fine-grained control over which proxy servers are used, depending on the socket requesting the proxy. This allows an application to apply different settings, according to the protocol or destination hostname, for instance.

QNetworkProxyFactory can be set globally for an application, in which case it will override any global proxies set with setApplicationProxy() . If set globally, any sockets created with Qt will query the factory to determine the proxy to be used.

A factory can also be set in certain frameworks that support multiple connections, such as QNetworkAccessManager . When set on such object, the factory will be queried for sockets created by that framework only.

System Proxies

You can configure a factory to use the system proxy’s settings. Call the setUseSystemConfiguration() function with true to enable this behavior, or false to disable it.

Similarly, you can use a factory to make queries directly to the system proxy by calling its function.


Depending on the configuration of the user’s system, the use of system proxy features on certain platforms may be subject to limitations. The documentation contains a list of these limitations for those platforms that are affected.

class PySide6.QtNetwork.QNetworkProxyFactory

Creates a QNetworkProxyFactory object.

Since QNetworkProxyFactory is an abstract class, you cannot create objects of type QNetworkProxyFactory directly.

static PySide6.QtNetwork.QNetworkProxyFactory.proxyForQuery(query)


Return type

This function takes the query request, query, examines the details of the type of socket or request and returns a list of QNetworkProxy objects that indicate the proxy servers to be used, in order of preference.



Return type

static PySide6.QtNetwork.QNetworkProxyFactory.setApplicationProxyFactory(factory)


Sets the application-wide proxy factory to be factory. This function will take ownership of that object and will delete it when necessary.

The application-wide proxy is used as a last-resort when all other proxy selection requests returned DefaultProxy . For example, QTcpSocket objects can have a proxy set with QTcpSocket::setProxy, but if none is set, the proxy factory class set with this function will be queried.

If you set a proxy factory with this function, any application level proxies set with setApplicationProxy will be overridden, and usesSystemConfiguration() will return false.

static PySide6.QtNetwork.QNetworkProxyFactory.setUseSystemConfiguration(enable)

enable – bool

Enables the use of the platform-specific proxy settings, and only those. See for more information.

Calling this function with enable set to true resets any proxy or QNetworkProxyFactory that is already set.


See the documentation for a list of limitations related to the use of system proxies.

static PySide6.QtNetwork.QNetworkProxyFactory.systemProxyForQuery([query=QNetworkProxyQuery()])


Return type

static PySide6.QtNetwork.QNetworkProxyFactory.usesSystemConfiguration()
Return type


Returns whether the use of platform-specific proxy settings are enabled.