|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.WebBrowser.CookieJar.CookieJar</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.WebBrowser.CookieJar.CookieJar</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a QNetworkCookieJar subclass with various accept policies. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#CookieJar">CookieJar</a></td> |
|
25 <td>Class implementing a QNetworkCookieJar subclass with various accept policies.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="CookieJar" ID="CookieJar"></a> |
|
36 <h2>CookieJar</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing a QNetworkCookieJar subclass with various accept |
|
40 policies. |
|
41 </p> |
|
42 <h3>Signals</h3> |
|
43 <dl> |
|
44 |
|
45 <dt>cookiesChanged()</dt> |
|
46 <dd> |
|
47 emitted after the cookies have been changed |
|
48 </dd> |
|
49 </dl> |
|
50 <h3>Derived from</h3> |
|
51 QNetworkCookieJar |
|
52 <h3>Class Attributes</h3> |
|
53 |
|
54 <table> |
|
55 <tr><td>AcceptAlways</td></tr><tr><td>AcceptMax</td></tr><tr><td>AcceptNever</td></tr><tr><td>AcceptOnlyFromSitesNavigatedTo</td></tr><tr><td>Allow</td></tr><tr><td>AllowForSession</td></tr><tr><td>Block</td></tr><tr><td>KeepMax</td></tr><tr><td>KeepUntilExit</td></tr><tr><td>KeepUntilExpire</td></tr> |
|
56 </table> |
|
57 <h3>Class Methods</h3> |
|
58 |
|
59 <table> |
|
60 <tr><td>None</td></tr> |
|
61 </table> |
|
62 <h3>Methods</h3> |
|
63 |
|
64 <table> |
|
65 |
|
66 <tr> |
|
67 <td><a href="#CookieJar.__init__">CookieJar</a></td> |
|
68 <td>Constructor</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#CookieJar.__cookieAdded">__cookieAdded</a></td> |
|
72 <td>Private slot handling the addition of a cookie.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#CookieJar.__cookieFilter">__cookieFilter</a></td> |
|
76 <td>Private method to filter cookies.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#CookieJar.__cookieRemoved">__cookieRemoved</a></td> |
|
80 <td>Private slot handling the removal of a cookie.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#CookieJar.__isOnDomainList">__isOnDomainList</a></td> |
|
84 <td>Private method to check, if either the rule matches the domain exactly or the domain ends with ".rule".</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#CookieJar.__load">__load</a></td> |
|
88 <td>Private method to load the cookies settings.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#CookieJar.__matchDomain">__matchDomain</a></td> |
|
92 <td>Private method to check, if a URLs host matches a cookie domain according to RFC 6265.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#CookieJar.__rejectCookie">__rejectCookie</a></td> |
|
96 <td>Private method to test, if a cookie shall be rejected.</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#CookieJar.__save">__save</a></td> |
|
100 <td>Private method to save the cookies settings.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#CookieJar.acceptPolicy">acceptPolicy</a></td> |
|
104 <td>Public method to get the accept policy.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#CookieJar.allowForSessionCookies">allowForSessionCookies</a></td> |
|
108 <td>Public method to return the list of allowed session cookie domains.</td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td><a href="#CookieJar.allowedCookies">allowedCookies</a></td> |
|
112 <td>Public method to return the list of allowed domains.</td> |
|
113 </tr> |
|
114 <tr> |
|
115 <td><a href="#CookieJar.blockedCookies">blockedCookies</a></td> |
|
116 <td>Public method to return the list of blocked domains.</td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td><a href="#CookieJar.clear">clear</a></td> |
|
120 <td>Public method to clear all cookies.</td> |
|
121 </tr> |
|
122 <tr> |
|
123 <td><a href="#CookieJar.close">close</a></td> |
|
124 <td>Public slot to close the cookie jar.</td> |
|
125 </tr> |
|
126 <tr> |
|
127 <td><a href="#CookieJar.cookieDomains">cookieDomains</a></td> |
|
128 <td>Public method to get a list of all domains used by the cookies.</td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td><a href="#CookieJar.cookies">cookies</a></td> |
|
132 <td>Public method to get the cookies of the cookie jar.</td> |
|
133 </tr> |
|
134 <tr> |
|
135 <td><a href="#CookieJar.filterTrackingCookies">filterTrackingCookies</a></td> |
|
136 <td>Public method to get the filter tracking cookies flag.</td> |
|
137 </tr> |
|
138 <tr> |
|
139 <td><a href="#CookieJar.keepPolicy">keepPolicy</a></td> |
|
140 <td>Public method to get the keep policy.</td> |
|
141 </tr> |
|
142 <tr> |
|
143 <td><a href="#CookieJar.removeCookie">removeCookie</a></td> |
|
144 <td>Public method to remove a cookie.</td> |
|
145 </tr> |
|
146 <tr> |
|
147 <td><a href="#CookieJar.removeCookies">removeCookies</a></td> |
|
148 <td>Public method to remove a list of cookies.</td> |
|
149 </tr> |
|
150 <tr> |
|
151 <td><a href="#CookieJar.setAcceptPolicy">setAcceptPolicy</a></td> |
|
152 <td>Public method to set the accept policy.</td> |
|
153 </tr> |
|
154 <tr> |
|
155 <td><a href="#CookieJar.setAllowForSessionCookies">setAllowForSessionCookies</a></td> |
|
156 <td>Public method to set the list of allowed session cookie domains.</td> |
|
157 </tr> |
|
158 <tr> |
|
159 <td><a href="#CookieJar.setAllowedCookies">setAllowedCookies</a></td> |
|
160 <td>Public method to set the list of allowed domains.</td> |
|
161 </tr> |
|
162 <tr> |
|
163 <td><a href="#CookieJar.setBlockedCookies">setBlockedCookies</a></td> |
|
164 <td>Public method to set the list of blocked domains.</td> |
|
165 </tr> |
|
166 <tr> |
|
167 <td><a href="#CookieJar.setFilterTrackingCookies">setFilterTrackingCookies</a></td> |
|
168 <td>Public method to set the filter tracking cookies flag.</td> |
|
169 </tr> |
|
170 <tr> |
|
171 <td><a href="#CookieJar.setKeepPolicy">setKeepPolicy</a></td> |
|
172 <td>Public method to set the keep policy.</td> |
|
173 </tr> |
|
174 </table> |
|
175 <h3>Static Methods</h3> |
|
176 |
|
177 <table> |
|
178 <tr><td>None</td></tr> |
|
179 </table> |
|
180 |
|
181 <a NAME="CookieJar.__init__" ID="CookieJar.__init__"></a> |
|
182 <h4>CookieJar (Constructor)</h4> |
|
183 <b>CookieJar</b>(<i>parent=None</i>) |
|
184 |
|
185 <p> |
|
186 Constructor |
|
187 </p> |
|
188 <dl> |
|
189 |
|
190 <dt><i>parent</i></dt> |
|
191 <dd> |
|
192 reference to the parent object (QObject) |
|
193 </dd> |
|
194 </dl> |
|
195 <a NAME="CookieJar.__cookieAdded" ID="CookieJar.__cookieAdded"></a> |
|
196 <h4>CookieJar.__cookieAdded</h4> |
|
197 <b>__cookieAdded</b>(<i>cookie</i>) |
|
198 |
|
199 <p> |
|
200 Private slot handling the addition of a cookie. |
|
201 </p> |
|
202 <dl> |
|
203 |
|
204 <dt><i>cookie</i> (QNetworkCookie)</dt> |
|
205 <dd> |
|
206 cookie which was added |
|
207 </dd> |
|
208 </dl> |
|
209 <a NAME="CookieJar.__cookieFilter" ID="CookieJar.__cookieFilter"></a> |
|
210 <h4>CookieJar.__cookieFilter</h4> |
|
211 <b>__cookieFilter</b>(<i>request</i>) |
|
212 |
|
213 <p> |
|
214 Private method to filter cookies. |
|
215 </p> |
|
216 <p> |
|
217 Note: This method is used for Qt 5.11+ only. |
|
218 </p> |
|
219 <dl> |
|
220 |
|
221 <dt><i>request</i> (QWebEngineCookieStore.FilterRequest)</dt> |
|
222 <dd> |
|
223 reference to the cookie filter request object |
|
224 </dd> |
|
225 </dl> |
|
226 <dl> |
|
227 <dt>Return:</dt> |
|
228 <dd> |
|
229 flag indicating cookie access is allowed |
|
230 </dd> |
|
231 </dl> |
|
232 <dl> |
|
233 <dt>Return Type:</dt> |
|
234 <dd> |
|
235 bool |
|
236 </dd> |
|
237 </dl> |
|
238 <a NAME="CookieJar.__cookieRemoved" ID="CookieJar.__cookieRemoved"></a> |
|
239 <h4>CookieJar.__cookieRemoved</h4> |
|
240 <b>__cookieRemoved</b>(<i>cookie</i>) |
|
241 |
|
242 <p> |
|
243 Private slot handling the removal of a cookie. |
|
244 </p> |
|
245 <dl> |
|
246 |
|
247 <dt><i>cookie</i> (QNetworkCookie)</dt> |
|
248 <dd> |
|
249 cookie which was removed |
|
250 </dd> |
|
251 </dl> |
|
252 <a NAME="CookieJar.__isOnDomainList" ID="CookieJar.__isOnDomainList"></a> |
|
253 <h4>CookieJar.__isOnDomainList</h4> |
|
254 <b>__isOnDomainList</b>(<i>rules, domain</i>) |
|
255 |
|
256 <p> |
|
257 Private method to check, if either the rule matches the domain exactly |
|
258 or the domain ends with ".rule". |
|
259 </p> |
|
260 <dl> |
|
261 |
|
262 <dt><i>rules</i></dt> |
|
263 <dd> |
|
264 list of rules (list of strings) |
|
265 </dd> |
|
266 <dt><i>domain</i></dt> |
|
267 <dd> |
|
268 domain name to check (string) |
|
269 </dd> |
|
270 </dl> |
|
271 <dl> |
|
272 <dt>Return:</dt> |
|
273 <dd> |
|
274 flag indicating a match (boolean) |
|
275 </dd> |
|
276 </dl> |
|
277 <a NAME="CookieJar.__load" ID="CookieJar.__load"></a> |
|
278 <h4>CookieJar.__load</h4> |
|
279 <b>__load</b>(<i></i>) |
|
280 |
|
281 <p> |
|
282 Private method to load the cookies settings. |
|
283 </p> |
|
284 <a NAME="CookieJar.__matchDomain" ID="CookieJar.__matchDomain"></a> |
|
285 <h4>CookieJar.__matchDomain</h4> |
|
286 <b>__matchDomain</b>(<i>cookieDomain, siteDomain</i>) |
|
287 |
|
288 <p> |
|
289 Private method to check, if a URLs host matches a cookie domain |
|
290 according to RFC 6265. |
|
291 </p> |
|
292 <dl> |
|
293 |
|
294 <dt><i>cookieDomain</i> (str)</dt> |
|
295 <dd> |
|
296 domain of the cookie |
|
297 </dd> |
|
298 <dt><i>siteDomain</i> (str)</dt> |
|
299 <dd> |
|
300 domain or host of an URL |
|
301 </dd> |
|
302 </dl> |
|
303 <dl> |
|
304 <dt>Return:</dt> |
|
305 <dd> |
|
306 flag indicating a match |
|
307 </dd> |
|
308 </dl> |
|
309 <dl> |
|
310 <dt>Return Type:</dt> |
|
311 <dd> |
|
312 bool |
|
313 </dd> |
|
314 </dl> |
|
315 <a NAME="CookieJar.__rejectCookie" ID="CookieJar.__rejectCookie"></a> |
|
316 <h4>CookieJar.__rejectCookie</h4> |
|
317 <b>__rejectCookie</b>(<i>cookie, cookieDomain</i>) |
|
318 |
|
319 <p> |
|
320 Private method to test, if a cookie shall be rejected. |
|
321 </p> |
|
322 <dl> |
|
323 |
|
324 <dt><i>cookie</i> (QNetworkCookie)</dt> |
|
325 <dd> |
|
326 cookie to be tested |
|
327 </dd> |
|
328 <dt><i>cookieDomain</i> (str)</dt> |
|
329 <dd> |
|
330 domain of the cookie |
|
331 </dd> |
|
332 </dl> |
|
333 <dl> |
|
334 <dt>Return:</dt> |
|
335 <dd> |
|
336 flag indicating the cookie shall be rejected |
|
337 </dd> |
|
338 </dl> |
|
339 <dl> |
|
340 <dt>Return Type:</dt> |
|
341 <dd> |
|
342 bool |
|
343 </dd> |
|
344 </dl> |
|
345 <a NAME="CookieJar.__save" ID="CookieJar.__save"></a> |
|
346 <h4>CookieJar.__save</h4> |
|
347 <b>__save</b>(<i></i>) |
|
348 |
|
349 <p> |
|
350 Private method to save the cookies settings. |
|
351 </p> |
|
352 <a NAME="CookieJar.acceptPolicy" ID="CookieJar.acceptPolicy"></a> |
|
353 <h4>CookieJar.acceptPolicy</h4> |
|
354 <b>acceptPolicy</b>(<i></i>) |
|
355 |
|
356 <p> |
|
357 Public method to get the accept policy. |
|
358 </p> |
|
359 <dl> |
|
360 <dt>Return:</dt> |
|
361 <dd> |
|
362 current accept policy |
|
363 </dd> |
|
364 </dl> |
|
365 <a NAME="CookieJar.allowForSessionCookies" ID="CookieJar.allowForSessionCookies"></a> |
|
366 <h4>CookieJar.allowForSessionCookies</h4> |
|
367 <b>allowForSessionCookies</b>(<i></i>) |
|
368 |
|
369 <p> |
|
370 Public method to return the list of allowed session cookie domains. |
|
371 </p> |
|
372 <dl> |
|
373 <dt>Return:</dt> |
|
374 <dd> |
|
375 list of allowed session cookie domains (list of strings) |
|
376 </dd> |
|
377 </dl> |
|
378 <a NAME="CookieJar.allowedCookies" ID="CookieJar.allowedCookies"></a> |
|
379 <h4>CookieJar.allowedCookies</h4> |
|
380 <b>allowedCookies</b>(<i></i>) |
|
381 |
|
382 <p> |
|
383 Public method to return the list of allowed domains. |
|
384 </p> |
|
385 <dl> |
|
386 <dt>Return:</dt> |
|
387 <dd> |
|
388 list of allowed domains (list of strings) |
|
389 </dd> |
|
390 </dl> |
|
391 <a NAME="CookieJar.blockedCookies" ID="CookieJar.blockedCookies"></a> |
|
392 <h4>CookieJar.blockedCookies</h4> |
|
393 <b>blockedCookies</b>(<i></i>) |
|
394 |
|
395 <p> |
|
396 Public method to return the list of blocked domains. |
|
397 </p> |
|
398 <dl> |
|
399 <dt>Return:</dt> |
|
400 <dd> |
|
401 list of blocked domains (list of strings) |
|
402 </dd> |
|
403 </dl> |
|
404 <a NAME="CookieJar.clear" ID="CookieJar.clear"></a> |
|
405 <h4>CookieJar.clear</h4> |
|
406 <b>clear</b>(<i></i>) |
|
407 |
|
408 <p> |
|
409 Public method to clear all cookies. |
|
410 </p> |
|
411 <a NAME="CookieJar.close" ID="CookieJar.close"></a> |
|
412 <h4>CookieJar.close</h4> |
|
413 <b>close</b>(<i></i>) |
|
414 |
|
415 <p> |
|
416 Public slot to close the cookie jar. |
|
417 </p> |
|
418 <a NAME="CookieJar.cookieDomains" ID="CookieJar.cookieDomains"></a> |
|
419 <h4>CookieJar.cookieDomains</h4> |
|
420 <b>cookieDomains</b>(<i></i>) |
|
421 |
|
422 <p> |
|
423 Public method to get a list of all domains used by the cookies. |
|
424 </p> |
|
425 <dl> |
|
426 <dt>Return:</dt> |
|
427 <dd> |
|
428 list of domain names |
|
429 </dd> |
|
430 </dl> |
|
431 <dl> |
|
432 <dt>Return Type:</dt> |
|
433 <dd> |
|
434 list of str |
|
435 </dd> |
|
436 </dl> |
|
437 <a NAME="CookieJar.cookies" ID="CookieJar.cookies"></a> |
|
438 <h4>CookieJar.cookies</h4> |
|
439 <b>cookies</b>(<i></i>) |
|
440 |
|
441 <p> |
|
442 Public method to get the cookies of the cookie jar. |
|
443 </p> |
|
444 <dl> |
|
445 <dt>Return:</dt> |
|
446 <dd> |
|
447 list of all cookies (list of QNetworkCookie) |
|
448 </dd> |
|
449 </dl> |
|
450 <a NAME="CookieJar.filterTrackingCookies" ID="CookieJar.filterTrackingCookies"></a> |
|
451 <h4>CookieJar.filterTrackingCookies</h4> |
|
452 <b>filterTrackingCookies</b>(<i></i>) |
|
453 |
|
454 <p> |
|
455 Public method to get the filter tracking cookies flag. |
|
456 </p> |
|
457 <dl> |
|
458 <dt>Return:</dt> |
|
459 <dd> |
|
460 filter tracking cookies flag (boolean) |
|
461 </dd> |
|
462 </dl> |
|
463 <a NAME="CookieJar.keepPolicy" ID="CookieJar.keepPolicy"></a> |
|
464 <h4>CookieJar.keepPolicy</h4> |
|
465 <b>keepPolicy</b>(<i></i>) |
|
466 |
|
467 <p> |
|
468 Public method to get the keep policy. |
|
469 </p> |
|
470 <dl> |
|
471 <dt>Return:</dt> |
|
472 <dd> |
|
473 keep policy |
|
474 </dd> |
|
475 </dl> |
|
476 <a NAME="CookieJar.removeCookie" ID="CookieJar.removeCookie"></a> |
|
477 <h4>CookieJar.removeCookie</h4> |
|
478 <b>removeCookie</b>(<i>cookie</i>) |
|
479 |
|
480 <p> |
|
481 Public method to remove a cookie. |
|
482 </p> |
|
483 <dl> |
|
484 |
|
485 <dt><i>cookie</i> (QNetworkCookie)</dt> |
|
486 <dd> |
|
487 cookie to be removed |
|
488 </dd> |
|
489 </dl> |
|
490 <a NAME="CookieJar.removeCookies" ID="CookieJar.removeCookies"></a> |
|
491 <h4>CookieJar.removeCookies</h4> |
|
492 <b>removeCookies</b>(<i>cookies</i>) |
|
493 |
|
494 <p> |
|
495 Public method to remove a list of cookies. |
|
496 </p> |
|
497 <dl> |
|
498 |
|
499 <dt><i>cookies</i> (list of QNetworkCookie)</dt> |
|
500 <dd> |
|
501 list of cookies to be removed |
|
502 </dd> |
|
503 </dl> |
|
504 <a NAME="CookieJar.setAcceptPolicy" ID="CookieJar.setAcceptPolicy"></a> |
|
505 <h4>CookieJar.setAcceptPolicy</h4> |
|
506 <b>setAcceptPolicy</b>(<i>policy</i>) |
|
507 |
|
508 <p> |
|
509 Public method to set the accept policy. |
|
510 </p> |
|
511 <dl> |
|
512 |
|
513 <dt><i>policy</i></dt> |
|
514 <dd> |
|
515 accept policy to be set |
|
516 </dd> |
|
517 </dl> |
|
518 <a NAME="CookieJar.setAllowForSessionCookies" ID="CookieJar.setAllowForSessionCookies"></a> |
|
519 <h4>CookieJar.setAllowForSessionCookies</h4> |
|
520 <b>setAllowForSessionCookies</b>(<i>list_</i>) |
|
521 |
|
522 <p> |
|
523 Public method to set the list of allowed session cookie domains. |
|
524 </p> |
|
525 <dl> |
|
526 |
|
527 <dt><i>list_</i></dt> |
|
528 <dd> |
|
529 list of allowed session cookie domains (list of strings) |
|
530 </dd> |
|
531 </dl> |
|
532 <a NAME="CookieJar.setAllowedCookies" ID="CookieJar.setAllowedCookies"></a> |
|
533 <h4>CookieJar.setAllowedCookies</h4> |
|
534 <b>setAllowedCookies</b>(<i>list_</i>) |
|
535 |
|
536 <p> |
|
537 Public method to set the list of allowed domains. |
|
538 </p> |
|
539 <dl> |
|
540 |
|
541 <dt><i>list_</i></dt> |
|
542 <dd> |
|
543 list of allowed domains (list of strings) |
|
544 </dd> |
|
545 </dl> |
|
546 <a NAME="CookieJar.setBlockedCookies" ID="CookieJar.setBlockedCookies"></a> |
|
547 <h4>CookieJar.setBlockedCookies</h4> |
|
548 <b>setBlockedCookies</b>(<i>list_</i>) |
|
549 |
|
550 <p> |
|
551 Public method to set the list of blocked domains. |
|
552 </p> |
|
553 <dl> |
|
554 |
|
555 <dt><i>list_</i></dt> |
|
556 <dd> |
|
557 list of blocked domains (list of strings) |
|
558 </dd> |
|
559 </dl> |
|
560 <a NAME="CookieJar.setFilterTrackingCookies" ID="CookieJar.setFilterTrackingCookies"></a> |
|
561 <h4>CookieJar.setFilterTrackingCookies</h4> |
|
562 <b>setFilterTrackingCookies</b>(<i>filterTrackingCookies</i>) |
|
563 |
|
564 <p> |
|
565 Public method to set the filter tracking cookies flag. |
|
566 </p> |
|
567 <dl> |
|
568 |
|
569 <dt><i>filterTrackingCookies</i></dt> |
|
570 <dd> |
|
571 filter tracking cookies flag (boolean) |
|
572 </dd> |
|
573 </dl> |
|
574 <a NAME="CookieJar.setKeepPolicy" ID="CookieJar.setKeepPolicy"></a> |
|
575 <h4>CookieJar.setKeepPolicy</h4> |
|
576 <b>setKeepPolicy</b>(<i>policy</i>) |
|
577 |
|
578 <p> |
|
579 Public method to set the keep policy. |
|
580 </p> |
|
581 <dl> |
|
582 |
|
583 <dt><i>policy</i></dt> |
|
584 <dd> |
|
585 keep policy to be set |
|
586 </dd> |
|
587 </dl> |
|
588 <div align="right"><a href="#top">Up</a></div> |
|
589 <hr /> |
|
590 </body></html> |