225 lines
18 KiB
HTML
225 lines
18 KiB
HTML
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: class Resource</title>
|
|
</head><body bgcolor="#f0f0f8">
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Resource">class <strong>Resource</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>A class for interacting with a resource.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="Resource-__init__"><strong>__init__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="Resource-list"><strong>list</strong></a> = method(self, **kwargs)</dt><dd><tt>Returns metadata about the search performed, metadata about the custom search engine used for the search, and the search results.<br>
|
|
<br>
|
|
Args:<br>
|
|
dateRestrict: string, Specifies all search results are from a time period<br>
|
|
orTerms: string, Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms<br>
|
|
highRange: string, Creates a range in form as_nlo value..as_nhi value and attempts to append it to query<br>
|
|
num: integer, Number of search results to return<br>
|
|
cr: string, Country restrict(s).<br>
|
|
imgType: string, Returns images of a type, which can be one of: clipart, face, lineart, news, and photo.<br>
|
|
Allowed values<br>
|
|
clipart - clipart<br>
|
|
face - face<br>
|
|
lineart - lineart<br>
|
|
news - news<br>
|
|
photo - photo<br>
|
|
relatedSite: string, Specifies that all search results should be pages that are related to the specified URL<br>
|
|
filter: string, Controls turning on or off the duplicate content filter.<br>
|
|
Allowed values<br>
|
|
0 - Turns off duplicate content filter.<br>
|
|
1 - Turns on duplicate content filter.<br>
|
|
gl: string, Geolocation of end user.<br>
|
|
searchType: string, Specifies the search type: image.<br>
|
|
Allowed values<br>
|
|
image - custom image search<br>
|
|
fileType: string, Returns images of a specified type. Some of the allowed values are: bmp, gif, png, jpg, svg, pdf, ...<br>
|
|
start: integer, The index of the first result to return<br>
|
|
imgDominantColor: string, Returns images of a specific dominant color: yellow, green, teal, blue, purple, pink, white, gray, black and brown.<br>
|
|
Allowed values<br>
|
|
black - black<br>
|
|
blue - blue<br>
|
|
brown - brown<br>
|
|
gray - gray<br>
|
|
green - green<br>
|
|
pink - pink<br>
|
|
purple - purple<br>
|
|
teal - teal<br>
|
|
white - white<br>
|
|
yellow - yellow<br>
|
|
lr: string, The language restriction for the search results<br>
|
|
Allowed values<br>
|
|
lang_ar - Arabic<br>
|
|
lang_bg - Bulgarian<br>
|
|
lang_ca - Catalan<br>
|
|
lang_cs - Czech<br>
|
|
lang_da - Danish<br>
|
|
lang_de - German<br>
|
|
lang_el - Greek<br>
|
|
lang_en - English<br>
|
|
lang_es - Spanish<br>
|
|
lang_et - Estonian<br>
|
|
lang_fi - Finnish<br>
|
|
lang_fr - French<br>
|
|
lang_hr - Croatian<br>
|
|
lang_hu - Hungarian<br>
|
|
lang_id - Indonesian<br>
|
|
lang_is - Icelandic<br>
|
|
lang_it - Italian<br>
|
|
lang_iw - Hebrew<br>
|
|
lang_ja - Japanese<br>
|
|
lang_ko - Korean<br>
|
|
lang_lt - Lithuanian<br>
|
|
lang_lv - Latvian<br>
|
|
lang_nl - Dutch<br>
|
|
lang_no - Norwegian<br>
|
|
lang_pl - Polish<br>
|
|
lang_pt - Portuguese<br>
|
|
lang_ro - Romanian<br>
|
|
lang_ru - Russian<br>
|
|
lang_sk - Slovak<br>
|
|
lang_sl - Slovenian<br>
|
|
lang_sr - Serbian<br>
|
|
lang_sv - Swedish<br>
|
|
lang_tr - Turkish<br>
|
|
lang_zh-CN - Chinese (Simplified)<br>
|
|
lang_zh-TW - Chinese (Traditional)<br>
|
|
siteSearch: string, Specifies all search results should be pages from a given site<br>
|
|
cref: string, The URL of a linked custom search engine<br>
|
|
sort: string, The sort expression to apply to the results<br>
|
|
hq: string, Appends the extra query terms to the query.<br>
|
|
c2coff: string, Turns off the translation between zh-CN and zh-TW.<br>
|
|
googlehost: string, The local Google domain to use to perform the search.<br>
|
|
safe: string, Search safety level<br>
|
|
Allowed values<br>
|
|
high - Enables highest level of safe search filtering.<br>
|
|
medium - Enables moderate safe search filtering.<br>
|
|
off - Disables safe search filtering.<br>
|
|
exactTerms: string, Identifies a phrase that all documents in the search results must contain<br>
|
|
hl: string, Sets the user interface language.<br>
|
|
lowRange: string, Creates a range in form as_nlo value..as_nhi value and attempts to append it to query<br>
|
|
imgSize: string, Returns images of a specified size, where size can be one of: icon, small, medium, large, xlarge, xxlarge, and huge.<br>
|
|
Allowed values<br>
|
|
huge - huge<br>
|
|
icon - icon<br>
|
|
large - large<br>
|
|
medium - medium<br>
|
|
small - small<br>
|
|
xlarge - xlarge<br>
|
|
xxlarge - xxlarge<br>
|
|
imgColorType: string, Returns black and white, grayscale, or color images: mono, gray, and color.<br>
|
|
Allowed values<br>
|
|
color - color<br>
|
|
gray - gray<br>
|
|
mono - mono<br>
|
|
rights: string, Filters based on licensing. Supported values include: cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial, cc_nonderived and combinations of these.<br>
|
|
excludeTerms: string, Identifies a word or phrase that should not appear in any documents in the search results<br>
|
|
q: string, Query (required)<br>
|
|
linkSite: string, Specifies that all search results should contain a link to a particular URL<br>
|
|
cx: string, The custom search engine ID to scope this search query<br>
|
|
siteSearchFilter: string, Controls whether to include or exclude results from the site named in the as_sitesearch parameter<br>
|
|
Allowed values<br>
|
|
e - exclude<br>
|
|
i - include<br>
|
|
<br>
|
|
Returns:<br>
|
|
An object of the form<br>
|
|
<br>
|
|
{<br>
|
|
"promotions": [<br>
|
|
{<br>
|
|
"link": "A String",<br>
|
|
"displayLink": "A String",<br>
|
|
"image": {<br>
|
|
"source": "A String",<br>
|
|
"width": 42,<br>
|
|
"height": 42,<br>
|
|
},<br>
|
|
"bodyLines": [<br>
|
|
{<br>
|
|
"url": "A String",<br>
|
|
"link": "A String",<br>
|
|
"title": "A String",<br>
|
|
},<br>
|
|
],<br>
|
|
"title": "A String",<br>
|
|
},<br>
|
|
],<br>
|
|
"kind": "customsearch#search",<br>
|
|
"url": {<br>
|
|
"type": "application/json",<br>
|
|
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json",<br>
|
|
},<br>
|
|
"items": [<br>
|
|
{<br>
|
|
"snippet": "A String",<br>
|
|
"kind": "customsearch#result",<br>
|
|
"labels": [<br>
|
|
{<br>
|
|
"displayName": "A String",<br>
|
|
"name": "A String",<br>
|
|
},<br>
|
|
],<br>
|
|
"title": "A String",<br>
|
|
"displayLink": "A String",<br>
|
|
"cacheId": "A String",<br>
|
|
"formattedUrl": "A String",<br>
|
|
"htmlFormattedUrl": "A String",<br>
|
|
"pagemap": {<br>
|
|
},<br>
|
|
"htmlTitle": "A String",<br>
|
|
"htmlSnippet": "A String",<br>
|
|
"link": "A String",<br>
|
|
"image": {<br>
|
|
"thumbnailWidth": 42,<br>
|
|
"byteSize": 42,<br>
|
|
"height": 42,<br>
|
|
"width": 42,<br>
|
|
"contextLink": "A String",<br>
|
|
"thumbnailLink": "A String",<br>
|
|
"thumbnailHeight": 42,<br>
|
|
},<br>
|
|
"mime": "A String",<br>
|
|
"fileFormat": "A String",<br>
|
|
},<br>
|
|
],<br>
|
|
"context": {<br>
|
|
"facets": [<br>
|
|
[<br>
|
|
{<br>
|
|
"anchor": "A String",<br>
|
|
"label": "A String",<br>
|
|
},<br>
|
|
],<br>
|
|
],<br>
|
|
"title": "A String",<br>
|
|
},<br>
|
|
"queries": {<br>
|
|
},<br>
|
|
"spelling": {<br>
|
|
"correctedQuery": "A String",<br>
|
|
"htmlCorrectedQuery": "A String",<br>
|
|
},<br>
|
|
"searchInformation": {<br>
|
|
"formattedSearchTime": "A String",<br>
|
|
"formattedTotalResults": "A String",<br>
|
|
"totalResults": "A String",<br>
|
|
"searchTime": 3.14,<br>
|
|
},<br>
|
|
}</tt></dd></dl>
|
|
|
|
<hr>
|
|
Data descriptors defined here:<br>
|
|
<dl><dt><strong>__dict__</strong></dt>
|
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
|
</dl>
|
|
<dl><dt><strong>__weakref__</strong></dt>
|
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
|
</dl>
|
|
</td></tr></table>
|
|
</body></html> |