*ë
n¶<c       s;    d  Z    d Z  d Z  d Z  d Z  d Z ! d k Z $ d Z ' d e f d	 „  ƒ  YZ	 ( d
 Z
 ) d Z * e i d ƒ Z + e i d ƒ Z - d „  Z 1 d „  Z 7 d f  d „  ƒ  YZ C d e f d „  ƒ  YZ W d e f d „  ƒ  YZ k d f  d „  ƒ  YZ v d d d d d d d d d „ Z d S(   s  Python wrapper for Google web APIs

This module allows you to access Google's web APIs through SOAP,
to do things like search Google and get the results programmatically.
Described here:
  http://www.google.com/apis/
  
You need a Google-provided license key to use these services.
Follow the link above to get one, then set the LICENSE_KEY variable
below before using any other functions in this module.

Sample usage:
>>> import google
>>> google.LICENSE_KEY = '...' # must get your own!
>>> data = google.doGoogleSearch('python')
>>> data.meta.searchTime
0.043221000000000002
>>> data.results[0].URL
'http://www.python.org/'
>>> data.results[0].title
'<b>Python</b> Language Website'

See documentation of SearchResultsMetaData and SearchResult classes
for other available attributes.
s$   Mark Pilgrim (f8dy@diveintomark.org)s   $Revision: 1.1.1.1 $s   $Date: 2002/04/12 03:51:11 $s   Copyright (c) 2002 Mark Pilgrims   PythonNs    0CMqT0BnpgU2zy7Pjsb+eIZxraUHJElHs   NoLicenseKeyc      s   ' ' RS(   N(    (    (    (    s	   google.pys   NoLicenseKey' s    s"   http://api.google.com/search/beta2s   urn:GoogleSearchi    i   c      s"   - . t  o / t d ‚ n d  S(   NsF   get a license key at http://www.google.com/apis/, then set LICENSE_KEY(   s   LICENSE_KEYs   NoLicenseKey(    (    (    s	   google.pys   _assertLicense- s   c    s#   1 2 |  o 3 t Sn 5 t Sd  S(   N(   s   values   _trues   _false(   s   value(    (    s	   google.pys   _marshalBoolean1 s   
s
   SearchBasec      s   7 8 d „  Z  RS(   Nc    sÏ   8 9 xÂ | i ƒ  d 9 r¯ \ } } : t | t i ƒ o ; | i } n < yT = t | d t i ƒ o6 > g  i } | d > r } | | i ƒ q} ~ } n Wn ? @ n XA | |  i t | ƒ <q Wd  S(   Ni    (   s   paramss   itemss   ks   vs
   isinstances   SOAPs
   structTypes   _asdicts   appends   _[1]s   nodes   selfs   __dict__s   str(   s   selfs   paramss   nodes   vs   ks   _[1](    (    s	   google.pys   __init__8 s     '(   s   __init__(    (    (    s	   google.pys
   SearchBase7 s   s   SearchResultsMetaDatac      s   C d  Z  T U RS(   sÉ  metadata of search query results

    Available attributes:
    documentFiltering - flag indicates whether duplicate page filtering was perfomed in this search
    searchComments - human-readable informational message (example: "'the' is a very common word
        and was not included in your search")
    estimatedTotalResultsCount - estimated total number of results for this query
    estimateIsExact - flag indicates whether estimatedTotalResultsCount is an exact value
    searchQuery - search string that initiated this search
    startIndex - index of first result returned (zero-based)
    endIndex - index of last result returned (zero-based)
    searchTips - human-readable informational message on how to use Google bette
    directoryCategories - list of dictionaries like this:
        {'fullViewableName': Open Directory category,
         'specialEncoding': encoding scheme of this directory category}
    searchTime - total search time, in seconds
    (   s   __doc__(    (    (    s	   google.pys   SearchResultsMetaDataC s   	s   SearchResultc      s   W d  Z  h i RS(   s5  search result

    Available attributes:
    URL - URL
    title - title (HTML)
    snippet - snippet showing query context (HTML)
    cachedSize - size of cached version of this result, (KB)
    relatedInformationPresent - flag indicates that the "related:" keyword is supported for this URL
    hostName: When filtering occurs, a maximum of two results from any given host is returned.
        When this occurs, the second resultElement that comes from that host contains
        the host name in this parameter.
    directoryCategory: dictionary like this:
        {'fullViewableName': Open Directory category,
         'specialEncoding': encoding scheme of this directory category}
    directoryTitle: Open Directory title of this result (or blank)
    summary - Open Directory summary for this result (or blank)
    (   s   __doc__(    (    (    s	   google.pys   SearchResultW s   	s   SearchReturnValuec      s   k d  Z  q r d „  Z RS(   sŽ   complete search results for a single query

    Available attributes:
    meta - SearchResultsMetaData
    results - list of SearchResult
    c    s   r s | |  _ t | |  _ d  S(   N(   s   metadatas   selfs   metas   results(   s   selfs   metadatas   results(    (    s	   google.pys   __init__r s   (   s   __doc__s   __init__(    (    (    s	   google.pys   SearchReturnValuek s   	i
   s    c	    sê   v — ˜ t  ƒ  ™ t i t d t ƒ} š t | ƒ } › t | ƒ } œ | i	 t
 |  | | | |  | | | | ƒ
 } ž | i }	 Ÿ |	 d =  t |	 ƒ }	 ¡ g  i }
 | i d ¡ r } |
 t | i ƒ ƒ q± ~
 } ¢ t |	 | ƒ Sd S(   s'  search Google

    LICENSE_KEY must be set correctly before calling this function, see
    http://www.google.com/apis/ to get one.
    
    Parameters:
    q - search string.  Anything you could type at google.com, you can pass here.
        See http://www.google.com/help/features.html for examples of advanced features.
    start (optional) - zero-based index of first desired result (for paging through
        multiple pages of results)
    maxResults (optional) - maximum number of results, currently capped at 10
    filter (optional) - set to 1 to filter out similar results, set to 0 to see everything
    restrict (optional) - restrict results by country or topic.  Examples:
        Ukraine - search only sites located in Ukraine
        linux - search Linux sites only
        mac - search Mac sites only
        bsd - search FreeBSD sites only
        See the APIs_reference.html file in the SDK (http://www.google.com/apis/download.html)
        for more advanced examples and a full list of country codes and topics.
    safeSearch (optional) - set to 1 to filter results with SafeSearch (no adult material)
    language (optional) - restricts search to documents in one or more languages.  Example:
        lang_en - only return pages in English
        lang_fr - only return pages in French
        See the APIs_reference.html file in the SDK (http://www.google.com/apis/download.html)
        for more advanced examples and a full list of language codes.
    inputencoding (optional) - sets the character encoding of q parameter
    outputencoding (optional) - sets the character encoding of the returned results
        See the APIs_reference.html file in the SDK (http://www.google.com/apis/download.html)
        for a full list of encodings.

    Returns: SearchMetaData, [SearchResult, SearchResult, ...]
    s	   namespaces   resultElementsi    N(   s   _assertLicenses   SOAPs	   SOAPProxys   _urls
   _namespaces   remoteservers   _marshalBooleans   filters
   safeSearchs   doGoogleSearchs   LICENSE_KEYs   qs   starts
   maxResultss   restricts   languages   inputencodings   outputencodings   datas   _asdicts   metadatas   SearchResultsMetaDatas   appends   _[1]s   resultElementss   nodes   SearchResults   resultss   SearchReturnValue(   s   qs   starts
   maxResultss   filters   restricts
   safeSearchs   languages   inputencodings   outputencodings   metadatas   _[1]s   datas   remoteservers   resultss   node(    (    s	   google.pys   doGoogleSearchv s   !

 %(   s   __doc__s
   __author__s   __version__s   __date__s   __copyright__s   __license__s   SOAPs   LICENSE_KEYs	   Exceptions   NoLicenseKeys   _urls
   _namespaces   booleanTypes   _falses   _trues   _assertLicenses   _marshalBooleans
   SearchBases   SearchResultsMetaDatas   SearchResults   SearchReturnValues   doGoogleSearch(   s   _marshalBooleans   SOAPs   __version__s   LICENSE_KEYs
   SearchBases   _urls   __copyright__s   NoLicenseKeys   _falses   __date__s
   __author__s   doGoogleSearchs   SearchResults   _trues   _assertLicenses   __license__s   SearchResultsMetaDatas   SearchReturnValues
   _namespace(    (    s	   google.pys   ? s&   								