Documentation/Source/eric6.WebBrowser.SafeBrowsing.SafeBrowsingAPIClient.html

changeset 5832
28f36b9c925f
child 6233
a64b986abb54
equal deleted inserted replaced
5831:536d97e3f1a1 5832:28f36b9c925f
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.SafeBrowsing.SafeBrowsingAPIClient</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.WebBrowser.SafeBrowsing.SafeBrowsingAPIClient</h1>
23 <p>
24 Module implementing the low level interface for Google Safe Browsing.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#SafeBrowsingAPIClient">SafeBrowsingAPIClient</a></td>
34 <td>Class implementing the low level interface for Google Safe Browsing.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr /><hr />
42 <a NAME="SafeBrowsingAPIClient" ID="SafeBrowsingAPIClient"></a>
43 <h2>SafeBrowsingAPIClient</h2>
44 <p>
45 Class implementing the low level interface for Google Safe Browsing.
46 </p><h3>Signals</h3>
47 <dl>
48 <dt>networkError(str)</dt>
49 <dd>
50 emitted to indicate a network error
51 </dd>
52 </dl>
53 <h3>Derived from</h3>
54 QObject
55 <h3>Class Attributes</h3>
56 <table>
57 <tr><td>ClientId</td></tr><tr><td>ClientVersion</td></tr><tr><td>GsbUrlTemplate</td></tr>
58 </table>
59 <h3>Class Methods</h3>
60 <table>
61 <tr>
62 <td><a href="#SafeBrowsingAPIClient.getPlatformString">getPlatformString</a></td>
63 <td>Class method to get the platform string for a given platform type.</td>
64 </tr><tr>
65 <td><a href="#SafeBrowsingAPIClient.getPlatformTypes">getPlatformTypes</a></td>
66 <td>Class method to get the platform types for a given platform.</td>
67 </tr><tr>
68 <td><a href="#SafeBrowsingAPIClient.getThreatEntryString">getThreatEntryString</a></td>
69 <td>Class method to get the threat entry string.</td>
70 </tr><tr>
71 <td><a href="#SafeBrowsingAPIClient.getThreatMessage">getThreatMessage</a></td>
72 <td>Class method to get a warning message for the given threat type.</td>
73 </tr><tr>
74 <td><a href="#SafeBrowsingAPIClient.getThreatType">getThreatType</a></td>
75 <td>Class method to get a display string for a given threat type.</td>
76 </tr>
77 </table>
78 <h3>Methods</h3>
79 <table>
80 <tr>
81 <td><a href="#SafeBrowsingAPIClient.__init__">SafeBrowsingAPIClient</a></td>
82 <td>Constructor</td>
83 </tr><tr>
84 <td><a href="#SafeBrowsingAPIClient.__extractData">__extractData</a></td>
85 <td>Private method to extract the data of a network reply.</td>
86 </tr><tr>
87 <td><a href="#SafeBrowsingAPIClient.__setWaitDuration">__setWaitDuration</a></td>
88 <td>Private method to set the minimum wait duration.</td>
89 </tr><tr>
90 <td><a href="#SafeBrowsingAPIClient.fairUseDelayExpired">fairUseDelayExpired</a></td>
91 <td>Public method to check, if the fair use wait period has expired.</td>
92 </tr><tr>
93 <td><a href="#SafeBrowsingAPIClient.getFairUseDelayExpirationDateTime">getFairUseDelayExpirationDateTime</a></td>
94 <td>Public method to get the date and time the fair use delay will expire.</td>
95 </tr><tr>
96 <td><a href="#SafeBrowsingAPIClient.getFullHashes">getFullHashes</a></td>
97 <td>Public method to find full hashes matching hash prefixes.</td>
98 </tr><tr>
99 <td><a href="#SafeBrowsingAPIClient.getThreatLists">getThreatLists</a></td>
100 <td>Public method to retrieve all available threat lists.</td>
101 </tr><tr>
102 <td><a href="#SafeBrowsingAPIClient.getThreatsUpdate">getThreatsUpdate</a></td>
103 <td>Public method to fetch hash prefix updates for the given threat list.</td>
104 </tr><tr>
105 <td><a href="#SafeBrowsingAPIClient.setApiKey">setApiKey</a></td>
106 <td>Public method to set the API key.</td>
107 </tr>
108 </table>
109 <h3>Static Methods</h3>
110 <table>
111 <tr><td>None</td></tr>
112 </table>
113 <a NAME="SafeBrowsingAPIClient.getPlatformString" ID="SafeBrowsingAPIClient.getPlatformString"></a>
114 <h4>SafeBrowsingAPIClient.getPlatformString (class method)</h4>
115 <b>getPlatformString</b>(<i>platformType</i>)
116 <p>
117 Class method to get the platform string for a given platform type.
118 </p><dl>
119 <dt><i>platformType</i> (str)</dt>
120 <dd>
121 platform type as defined in the v4 API
122 </dd>
123 </dl><dl>
124 <dt>Returns:</dt>
125 <dd>
126 platform string
127 </dd>
128 </dl><dl>
129 <dt>Return Type:</dt>
130 <dd>
131 str
132 </dd>
133 </dl><a NAME="SafeBrowsingAPIClient.getPlatformTypes" ID="SafeBrowsingAPIClient.getPlatformTypes"></a>
134 <h4>SafeBrowsingAPIClient.getPlatformTypes (class method)</h4>
135 <b>getPlatformTypes</b>(<i>platform</i>)
136 <p>
137 Class method to get the platform types for a given platform.
138 </p><dl>
139 <dt><i>platform</i> (str (one of 'linux', 'windows', 'macos'))</dt>
140 <dd>
141 platform string
142 </dd>
143 </dl><dl>
144 <dt>Returns:</dt>
145 <dd>
146 list of platform types as defined in the v4 API for the
147 given platform
148 </dd>
149 </dl><dl>
150 <dt>Return Type:</dt>
151 <dd>
152 list of str
153 </dd>
154 </dl><dl>
155 <dt>Raises <b>ValueError</b>:</dt>
156 <dd>
157 raised to indicate an invalid platform string
158 </dd>
159 </dl><a NAME="SafeBrowsingAPIClient.getThreatEntryString" ID="SafeBrowsingAPIClient.getThreatEntryString"></a>
160 <h4>SafeBrowsingAPIClient.getThreatEntryString (class method)</h4>
161 <b>getThreatEntryString</b>(<i>threatEntry</i>)
162 <p>
163 Class method to get the threat entry string.
164 </p><dl>
165 <dt><i>threatEntry</i> (str)</dt>
166 <dd>
167 threat entry type as defined in the v4 API
168 </dd>
169 </dl><dl>
170 <dt>Returns:</dt>
171 <dd>
172 threat entry string
173 </dd>
174 </dl><dl>
175 <dt>Return Type:</dt>
176 <dd>
177 str
178 </dd>
179 </dl><a NAME="SafeBrowsingAPIClient.getThreatMessage" ID="SafeBrowsingAPIClient.getThreatMessage"></a>
180 <h4>SafeBrowsingAPIClient.getThreatMessage (class method)</h4>
181 <b>getThreatMessage</b>(<i>threatType</i>)
182 <p>
183 Class method to get a warning message for the given threat type.
184 </p><dl>
185 <dt><i>threatType</i> (str)</dt>
186 <dd>
187 threat type to get the message for
188 </dd>
189 </dl><dl>
190 <dt>Returns:</dt>
191 <dd>
192 threat message
193 </dd>
194 </dl><dl>
195 <dt>Return Type:</dt>
196 <dd>
197 str
198 </dd>
199 </dl><a NAME="SafeBrowsingAPIClient.getThreatType" ID="SafeBrowsingAPIClient.getThreatType"></a>
200 <h4>SafeBrowsingAPIClient.getThreatType (class method)</h4>
201 <b>getThreatType</b>(<i>threatType</i>)
202 <p>
203 Class method to get a display string for a given threat type.
204 </p><dl>
205 <dt><i>threatType</i> (str)</dt>
206 <dd>
207 threat type to get display string for
208 </dd>
209 </dl><dl>
210 <dt>Returns:</dt>
211 <dd>
212 display string
213 </dd>
214 </dl><dl>
215 <dt>Return Type:</dt>
216 <dd>
217 str
218 </dd>
219 </dl><a NAME="SafeBrowsingAPIClient.__init__" ID="SafeBrowsingAPIClient.__init__"></a>
220 <h4>SafeBrowsingAPIClient (Constructor)</h4>
221 <b>SafeBrowsingAPIClient</b>(<i>apiKey, fairUse=True, parent=None</i>)
222 <p>
223 Constructor
224 </p><dl>
225 <dt><i>apiKey</i> (str)</dt>
226 <dd>
227 API key to be used
228 </dd><dt><i>fairUse</i> (bool)</dt>
229 <dd>
230 flag indicating to follow the fair use policy
231 </dd><dt><i>parent</i> (QObject)</dt>
232 <dd>
233 reference to the parent object
234 </dd>
235 </dl><a NAME="SafeBrowsingAPIClient.__extractData" ID="SafeBrowsingAPIClient.__extractData"></a>
236 <h4>SafeBrowsingAPIClient.__extractData</h4>
237 <b>__extractData</b>(<i>reply</i>)
238 <p>
239 Private method to extract the data of a network reply.
240 </p><dl>
241 <dt><i>reply</i> (QNetworkReply)</dt>
242 <dd>
243 reference to the network reply object
244 </dd>
245 </dl><dl>
246 <dt>Returns:</dt>
247 <dd>
248 extracted data
249 </dd>
250 </dl><dl>
251 <dt>Return Type:</dt>
252 <dd>
253 list or dict
254 </dd>
255 </dl><a NAME="SafeBrowsingAPIClient.__setWaitDuration" ID="SafeBrowsingAPIClient.__setWaitDuration"></a>
256 <h4>SafeBrowsingAPIClient.__setWaitDuration</h4>
257 <b>__setWaitDuration</b>(<i>minimumWaitDuration</i>)
258 <p>
259 Private method to set the minimum wait duration.
260 </p><dl>
261 <dt><i>minimumWaitDuration</i> (str)</dt>
262 <dd>
263 duration to be set
264 </dd>
265 </dl><a NAME="SafeBrowsingAPIClient.fairUseDelayExpired" ID="SafeBrowsingAPIClient.fairUseDelayExpired"></a>
266 <h4>SafeBrowsingAPIClient.fairUseDelayExpired</h4>
267 <b>fairUseDelayExpired</b>(<i></i>)
268 <p>
269 Public method to check, if the fair use wait period has expired.
270 </p><dl>
271 <dt>Returns:</dt>
272 <dd>
273 flag indicating expiration
274 </dd>
275 </dl><dl>
276 <dt>Return Type:</dt>
277 <dd>
278 bool
279 </dd>
280 </dl><a NAME="SafeBrowsingAPIClient.getFairUseDelayExpirationDateTime" ID="SafeBrowsingAPIClient.getFairUseDelayExpirationDateTime"></a>
281 <h4>SafeBrowsingAPIClient.getFairUseDelayExpirationDateTime</h4>
282 <b>getFairUseDelayExpirationDateTime</b>(<i></i>)
283 <p>
284 Public method to get the date and time the fair use delay will expire.
285 </p><dl>
286 <dt>Returns:</dt>
287 <dd>
288 fair use delay expiration date and time
289 </dd>
290 </dl><dl>
291 <dt>Return Type:</dt>
292 <dd>
293 QDateTime
294 </dd>
295 </dl><a NAME="SafeBrowsingAPIClient.getFullHashes" ID="SafeBrowsingAPIClient.getFullHashes"></a>
296 <h4>SafeBrowsingAPIClient.getFullHashes</h4>
297 <b>getFullHashes</b>(<i>prefixes, clientState</i>)
298 <p>
299 Public method to find full hashes matching hash prefixes.
300 </p><dl>
301 <dt><i>prefixes</i> (list of str (Python 2) or list of bytes (Python 3))</dt>
302 <dd>
303 list of hash prefixes to find
304 </dd><dt><i>clientState</i> (dict)</dt>
305 <dd>
306 dictionary of client states with keys like
307 (threatType, platformType, threatEntryType)
308 </dd>
309 </dl><dl>
310 <dt>Returns:</dt>
311 <dd>
312 dictionary containing the list of found hashes and the
313 negative cache duration
314 </dd>
315 </dl><dl>
316 <dt>Return Type:</dt>
317 <dd>
318 dict
319 </dd>
320 </dl><a NAME="SafeBrowsingAPIClient.getThreatLists" ID="SafeBrowsingAPIClient.getThreatLists"></a>
321 <h4>SafeBrowsingAPIClient.getThreatLists</h4>
322 <b>getThreatLists</b>(<i></i>)
323 <p>
324 Public method to retrieve all available threat lists.
325 </p><dl>
326 <dt>Returns:</dt>
327 <dd>
328 list of threat lists
329 </dd>
330 </dl><dl>
331 <dt>Return Type:</dt>
332 <dd>
333 list of dict containing 'threatType', 'platformType' and
334 'threatEntryType'
335 </dd>
336 </dl><a NAME="SafeBrowsingAPIClient.getThreatsUpdate" ID="SafeBrowsingAPIClient.getThreatsUpdate"></a>
337 <h4>SafeBrowsingAPIClient.getThreatsUpdate</h4>
338 <b>getThreatsUpdate</b>(<i>clientStates</i>)
339 <p>
340 Public method to fetch hash prefix updates for the given threat list.
341 </p><dl>
342 <dt><i>clientStates</i> (dict)</dt>
343 <dd>
344 dictionary of client states with keys like
345 (threatType, platformType, threatEntryType)
346 </dd>
347 </dl><dl>
348 <dt>Returns:</dt>
349 <dd>
350 list of threat updates
351 </dd>
352 </dl><dl>
353 <dt>Return Type:</dt>
354 <dd>
355 list of dict
356 </dd>
357 </dl><a NAME="SafeBrowsingAPIClient.setApiKey" ID="SafeBrowsingAPIClient.setApiKey"></a>
358 <h4>SafeBrowsingAPIClient.setApiKey</h4>
359 <b>setApiKey</b>(<i>apiKey</i>)
360 <p>
361 Public method to set the API key.
362 </p><dl>
363 <dt><i>apiKey</i> (str)</dt>
364 <dd>
365 API key to be set
366 </dd>
367 </dl>
368 <div align="right"><a href="#top">Up</a></div>
369 <hr />
370 </body></html>

eric ide

mercurial