QNetworkProxyFactory

The QNetworkProxyFactory class provides fine-grained proxy selection. More

Inheritance diagram of PySide6.QtNetwork.QNetworkProxyFactory

Synopsis

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.

Warning

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)
Parameters

queryPySide6.QtNetwork.QNetworkProxyQuery

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.

PySide6.QtNetwork.QNetworkProxyFactory.queryProxy([query=QNetworkProxyQuery()])
Parameters

queryPySide6.QtNetwork.QNetworkProxyQuery

Return type

static PySide6.QtNetwork.QNetworkProxyFactory.setApplicationProxyFactory(factory)
Parameters

factoryPySide6.QtNetwork.QNetworkProxyFactory

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 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)
Parameters

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.

Note

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

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

queryPySide6.QtNetwork.QNetworkProxyQuery

Return type

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

bool

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