KIO.AccessManager

KDE 4.5 PyKDE API Reference

- KDE's Python API

# AccessManager Class Reference

`from PyKDE4.kio import *`

Inherits:
Namespace: KIO

## Detailed Description

A KDE implementation of QNetworkAccessManager.

Use this class instead of QNetworkAccessManager if you want to integrate with KDE's KIO and KCookieJar modules for network operations and cookie handling respectively.

Here is a simple example that shows how to set the QtWebKit module to use KDE's KIO for its network operations:

       QWebView *view = new QWebView(this);
       KIO.Integration.AccessManager *manager = new KIO.Integration.AccessManager(view);
       view->page()->setNetworkAccessManager(manager);

To access member functions in the cookiejar class at a later point in your code simply downcast the pointer returned by QWebPage.networkAccessManager as follows:

       KIO.Integration.AccessManager *manager = qobject_cast<KIO.Integration.AccessManager*>(view->page()->accessManager());

Please note that this class is in the KIO namespace for backward compatablity. You should use KIO.Integration.AccessManager to access this class in your code.

IMPORTANTThis class is not a replacement for the standard KDE API. It should ONLY be used to to provide KDE integration in applications that cannot use the standard KDE API directly.

Author:
  Urs Wolfer <uwolfer @kde.org>

Deprecated:
  Use the KIO.Integration.AccessManager typedef to access this class instead.

Since:
  4.3

## Enumerations
Attribute | { MetaData, KioError }
## Methods
| __init__ (self, QObject parent)
int | cookieJarWindowid (self)
QNetworkReply | createRequest (self, Operation op, QNetworkRequest req, QIODevice outgoingData=0)
bool | isExternalContentAllowed (self)
KIO.MetaData | requestMetaData (self)
KIO.MetaData | sessionMetaData (self)
| setCookieJarWindowId (self, int id)
| setExternalContentAllowed (self, bool allowed)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent
| ) |  |  |

int cookieJarWindowid | ( |  | self ) |

Returns the cookiejar's window id.

This is a convenience function that returns the window id associated with the cookiejar. Note that this function will return a 0 if the cookiejar is not of type KIO.Integration.CookieJar or a window id has not yet been set.

See also:
  KIO.Integration.CookieJar.windowId.

Since:
  4.4

QNetworkReply createRequest | ( | self, |
|  | Operation | op,
|  | QNetworkRequest | req,
|  | QIODevice | outgoingData=0
| ) |  |  |

Reimplemented for internal reasons, the API is not affected.

See also:
  QNetworkAccessManager.createRequest

Internal:

bool isExternalContentAllowed | ( |  | self ) |

Returns true if external content is going to be fetched.

See also:
  setExternalContentAllowed

KIO.MetaData requestMetaData | ( |  | self ) |

Returns a reference to the temporary meta data container.

See kdelibs/kio/DESIGN.metadata for list of supported KIO meta data.

Use this function when you want to set per request KIO meta data that will be removed after it has been sent once.

Since:
  4.4

KIO.MetaData sessionMetaData | ( |  | self ) |

Returns a reference to the persistent meta data container.

See kdelibs/kio/DESIGN.metadata for list of supported KIO meta data.

Use this function when you want to set per session KIO meta data that will be sent with every request.

Unlike requestMetaData, the meta data values set using the reference returned by this function will not be deleted and will be sent with every request.

Since:
  4.4

setCookieJarWindowId | ( | self, |
|  | int | id
| ) |  |  |

Sets the cookiejar's window id to id.

This is a convenience function that allows you to set the cookiejar's window id. Note that this function does nothing unless the cookiejar in use is of type KIO.Integration.CookieJar.

By default the cookiejar's window id is set to false. Make sure you call this function and set the window id to its proper value when create an instance of this object. Otherwise, the KDE cookiejar will not be able to properly manage session based cookies.

See also:
  KIO.Integration.CookieJar.setWindowId.

Since:
  4.4

setExternalContentAllowed | ( | self, |
|  | bool | allowed
| ) |  |  |

Set allowed to false if you don't want any external content to be fetched. By default external content is fetched.

## Enumeration Documentation

Attribute

Enumerator:

  MetaData = QNetworkRequest::User |
  KioError |