Python: module yahoo.search.myweb

yahoo.search.myweb (version 1.5, Tue Feb 27 17:06:45 MST 2007) | index /home/leif/hack/pysearch/yahoo/search/myweb.py

`yahoo.search.myweb - Yahoo Search MyWeb Web Services
This module implements a set of classes and functions to work with the
Yahoo Search MyWeb Web Services. The supported classes of MyWeb
and MyWeb2 searches are:
ListFolders - List (public) MyWeb folders
ListUrls - List the URLs in a MyWeb folder
UrlSearch - Search for URLs with particular tags
TagSearch - Search for tags associated with URL or user
RelatedTags - Find tags that appear together on URLs
The various sub-classes of MyWeb Search supports different sets of query
parameters. They all require an application ID parameter (app_id). The
following tables describes all other allowed parameters for each of the
supported services:
List Folders List URLs
------------ ---------
folder . [X]
yahooid [X] [X]
sort . [X]
sort_order . [X]
results [X] [X]
start [X] [X]
MyWeb2 also adds the following services:
URL Search Tag Search Related Tags
---------- ---------- ------------
tag [X] . [X]
url . [X] .
yahooid [X] [X] [X]
sort [X] [X] [X]
reverse_sort [X] [X] [X]
results [X] [X] [X]
start [X] [X] [X]
Each of these parameter is implemented as an attribute of each
respective class. For example, you can set parameters like:
from yahoo.search.myweb import ListFolders
app_id = "YahooDemo"
srch = ListFolders(app_id)
srch.yahooid = "some_valid_yahoo_id"
srch.results = 40`

Modules
`` |  |
types | yahoo |  |

Classes
`` |  | _MyWeb(yahoo.search._Search) ListFolders ListUrls RelatedTags TagSearch UrlSearch
class ListFolders(_MyWeb)
`` | `ListFolders - Retrieving public folders This class implements the My Web service to retrieve public folders. Allowed parameters are: yahooid - The Yahoo! user who owns the folder being accessed. results - The number of results to return (1-50). start - The starting result position to return (1-based). The finishing position (start + results - 1) cannot exceed 1000. output - The format for the output result. If json or php is requested, the result is not XML parseable, so we will simply return the "raw" string. callback - The name of the callback function to wrap around the JSON data. Full documentation for this service is available at: http://developer.yahoo.net/myweb/V1/listFolders.html`
| Method resolution order: ListFolders _MyWeb yahoo.search._Search yahoo.search.debug.Debuggable __builtin__.object Data and other attributes defined here: NAME = 'listFolders' SERVICE = 'MyWebService' Methods inherited from yahoo.search._Search: __getattr__(self, name) __init__(self, app_id, opener=None, xml_parser=None, result_factory=None, debug_level=0, **args) `The app_id is a required argument, the Yahoo search services will not accept requests without a proper app_id. A valid app_id is a combination of 8 - 40 characters, matching the regexp "^[a-zA-Z0-9 _()\[\]*+\-=,.:\\@]{8,40}$" Please visit http://developer.yahoo.net/search/ to request an App ID for your own software or application. Four optional arguments can also be passed to the constructor: opener - Opener for urllib2 xml_parser - Function to parse XML (default: minidom) result_factory - Result factory class (default: none) debug_devel - Debug level (if any) All other "named" arguments are passed into as a dictionary to the set_params() method. The result factory is specific to the particular web service used, e.g. the different Yahoo Search services will each implement their own factory class. Both of these settings can be controlled via their respective install method (see below).` __setattr__(self, name, value) `# Implement the attribute handlers, to avoid confusion` encode_params(self) `URL encode the list of parameter values.` get_param(self, param) `Get the value of a query parameter, or the default value if unset` get_results(self, stream=None, xml_parser=None, close=True) `Read the stream (if provided) and either return the raw XML, or send the data to the provided XML parser for further processing. If no stream is provided, it will call the open() method using the default opener. The stream will be closed upon return from this method, unless the close=False is passed as an argument.` get_url(self, with_params=True) `Return the URL for this request object` get_valid_params(self) `Return a list of all valid parameters for this search` install_opener(self, opener) `Install a URL opener (for use with urllib2), overriding the default opener. This is rarely required.` install_result_factory(self, result_factory) `Install a python class (not an instance!) that should be used as a factory for creating result(s) objects.` install_xml_parser(self, xml_parser) `Install an XML parser that will be used for all results for this object. The parser is expected to "read" the data from the supplied stream argument. To uninstall the parser (e.g. to make sure we return raw XML data) simply call this method with an argument of None.` missing_params(self) `Validate that the search object is propertly setup with all required parameters etc. This is called automatically before a search is actually performed, but you can also call it manually if desired. It will return a list of zero or more paramters that are missing.` open(self, opener=None, retries=2) `Open a connection to the webservice server, and request the URL. The return value is a "stream", which can be read calling the read(), readline() or readlines() methods. If you override this method, please make sure to call the missing_params() method before you try to send a request to the Web server.` parse_results(self, xml=None) `Get the result from the request, and instantiate the appropriate result class. This class will be populated with all the data from the XML object.` reset(self) `Reset all the parameter values for the object instance.` set_param(self, param, value) `Set the value of a query parameter` set_params(self, args) `Set one or several query parameters from a dictionary` Data descriptors inherited from yahoo.search._Search: app_id `Application ID (issued by Yahoo), same ass appid` appid `Application ID (issued by Yahoo)` cc_licenses `List of all supported Creative Commons licenses` countries `List of all supported county codes` debug_level `Set and modify the debug level` languages `List of all supported languages` regions `List of all supported region codes` subscriptions `List of all supported premium subscriptions` svc_name `Descriptive name of the service` svc_protocol `Service protocol (e.g. HTTP)` svc_server `Service server name or IP` svc_service `Service path` svc_version `Service version string` Data and other attributes inherited from yahoo.search._Search: METHOD = 'GET' PROTOCOL = 'http' SERVER = 'search.yahooapis.com' VERSION = 'V1' Data descriptors inherited from yahoo.search.debug.Debuggable: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class ListUrls(_MyWeb)
`` | `ListUrls - Retrieving public URL stores This class implements the My Web service to retrieve URLs from a public folder. Allowed parameters are: folder - The folder to retreive queries from. The folder must be set to "Public" in order to be accessed. yahooid - The Yahoo! user who owns the folder being accessed. sort - The field by which the results should be sorted. sort_order - Ascending or descending sort order, "asc" which is the default, or "desc". results - The number of results to return (1-50). start - The starting result position to return (1-based). The finishing position (start + results - 1) cannot exceed 1000. output - The format for the output result. If json or php is requested, the result is not XML parseable, so we will simply return the "raw" string. callback - The name of the callback function to wrap around the JSON data. The sort parameter can take one of the following values: storedate - Date stored (default) title - Title summary - Summary note - Note url - URL Full documentation for this service is available at: http://developer.yahoo.net/myweb/V1/listUrls.html`
| Method resolution order: ListUrls _MyWeb yahoo.search._Search yahoo.search.debug.Debuggable __builtin__.object Data and other attributes defined here: NAME = 'listUrls' SERVICE = 'MyWebService' Methods inherited from yahoo.search._Search: __getattr__(self, name) __init__(self, app_id, opener=None, xml_parser=None, result_factory=None, debug_level=0, **args) `The app_id is a required argument, the Yahoo search services will not accept requests without a proper app_id. A valid app_id is a combination of 8 - 40 characters, matching the regexp "^[a-zA-Z0-9 _()\[\]*+\-=,.:\\@]{8,40}$" Please visit http://developer.yahoo.net/search/ to request an App ID for your own software or application. Four optional arguments can also be passed to the constructor: opener - Opener for urllib2 xml_parser - Function to parse XML (default: minidom) result_factory - Result factory class (default: none) debug_devel - Debug level (if any) All other "named" arguments are passed into as a dictionary to the set_params() method. The result factory is specific to the particular web service used, e.g. the different Yahoo Search services will each implement their own factory class. Both of these settings can be controlled via their respective install method (see below).` __setattr__(self, name, value) `# Implement the attribute handlers, to avoid confusion` encode_params(self) `URL encode the list of parameter values.` get_param(self, param) `Get the value of a query parameter, or the default value if unset` get_results(self, stream=None, xml_parser=None, close=True) `Read the stream (if provided) and either return the raw XML, or send the data to the provided XML parser for further processing. If no stream is provided, it will call the open() method using the default opener. The stream will be closed upon return from this method, unless the close=False is passed as an argument.` get_url(self, with_params=True) `Return the URL for this request object` get_valid_params(self) `Return a list of all valid parameters for this search` install_opener(self, opener) `Install a URL opener (for use with urllib2), overriding the default opener. This is rarely required.` install_result_factory(self, result_factory) `Install a python class (not an instance!) that should be used as a factory for creating result(s) objects.` install_xml_parser(self, xml_parser) `Install an XML parser that will be used for all results for this object. The parser is expected to "read" the data from the supplied stream argument. To uninstall the parser (e.g. to make sure we return raw XML data) simply call this method with an argument of None.` missing_params(self) `Validate that the search object is propertly setup with all required parameters etc. This is called automatically before a search is actually performed, but you can also call it manually if desired. It will return a list of zero or more paramters that are missing.` open(self, opener=None, retries=2) `Open a connection to the webservice server, and request the URL. The return value is a "stream", which can be read calling the read(), readline() or readlines() methods. If you override this method, please make sure to call the missing_params() method before you try to send a request to the Web server.` parse_results(self, xml=None) `Get the result from the request, and instantiate the appropriate result class. This class will be populated with all the data from the XML object.` reset(self) `Reset all the parameter values for the object instance.` set_param(self, param, value) `Set the value of a query parameter` set_params(self, args) `Set one or several query parameters from a dictionary` Data descriptors inherited from yahoo.search._Search: app_id `Application ID (issued by Yahoo), same ass appid` appid `Application ID (issued by Yahoo)` cc_licenses `List of all supported Creative Commons licenses` countries `List of all supported county codes` debug_level `Set and modify the debug level` languages `List of all supported languages` regions `List of all supported region codes` subscriptions `List of all supported premium subscriptions` svc_name `Descriptive name of the service` svc_protocol `Service protocol (e.g. HTTP)` svc_server `Service server name or IP` svc_service `Service path` svc_version `Service version string` Data and other attributes inherited from yahoo.search._Search: METHOD = 'GET' PROTOCOL = 'http' SERVER = 'search.yahooapis.com' VERSION = 'V1' Data descriptors inherited from yahoo.search.debug.Debuggable: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class RelatedTags(_MyWeb)
`` | `RelatedTags - Find tags that appear together on URLs This class implements a MyWeb2 service which allows you to find tags that appear together on URLs. For example, if a URL is tagger with 'yahoo' and 'music', a search for the tag 'yahoo' will return 'music' as a related tag. tag - The tag to search for. Multiple tags may be specified (e.g. ["tag1", "tag2"]). yahooid - The Yahoo! user who owns the folder being accessed. sort - The field by which the results should be sorted. Options are popularity (default), tag or date. reverse_sort - If set to 1, reverses the sort order. This has no effect on popularity searches. results - The number of results to return (1-50). start - The starting result position to return (1-based). The finishing position (start + results - 1) cannot exceed 1000. output - The format for the output result. If json or php is requested, the result is not XML parseable, so we will simply return the "raw" string. callback - The name of the callback function to wrap around the JSON data. Full documentation for this service is available at: http://developer.yahoo.net/myweb/V1/relatedTags.html`
| Method resolution order: RelatedTags _MyWeb yahoo.search._Search yahoo.search.debug.Debuggable __builtin__.object Data and other attributes defined here: NAME = 'relatedTags' SERVICE = 'MyWebService' Methods inherited from yahoo.search._Search: __getattr__(self, name) __init__(self, app_id, opener=None, xml_parser=None, result_factory=None, debug_level=0, **args) `The app_id is a required argument, the Yahoo search services will not accept requests without a proper app_id. A valid app_id is a combination of 8 - 40 characters, matching the regexp "^[a-zA-Z0-9 _()\[\]*+\-=,.:\\@]{8,40}$" Please visit http://developer.yahoo.net/search/ to request an App ID for your own software or application. Four optional arguments can also be passed to the constructor: opener - Opener for urllib2 xml_parser - Function to parse XML (default: minidom) result_factory - Result factory class (default: none) debug_devel - Debug level (if any) All other "named" arguments are passed into as a dictionary to the set_params() method. The result factory is specific to the particular web service used, e.g. the different Yahoo Search services will each implement their own factory class. Both of these settings can be controlled via their respective install method (see below).` __setattr__(self, name, value) `# Implement the attribute handlers, to avoid confusion` encode_params(self) `URL encode the list of parameter values.` get_param(self, param) `Get the value of a query parameter, or the default value if unset` get_results(self, stream=None, xml_parser=None, close=True) `Read the stream (if provided) and either return the raw XML, or send the data to the provided XML parser for further processing. If no stream is provided, it will call the open() method using the default opener. The stream will be closed upon return from this method, unless the close=False is passed as an argument.` get_url(self, with_params=True) `Return the URL for this request object` get_valid_params(self) `Return a list of all valid parameters for this search` install_opener(self, opener) `Install a URL opener (for use with urllib2), overriding the default opener. This is rarely required.` install_result_factory(self, result_factory) `Install a python class (not an instance!) that should be used as a factory for creating result(s) objects.` install_xml_parser(self, xml_parser) `Install an XML parser that will be used for all results for this object. The parser is expected to "read" the data from the supplied stream argument. To uninstall the parser (e.g. to make sure we return raw XML data) simply call this method with an argument of None.` missing_params(self) `Validate that the search object is propertly setup with all required parameters etc. This is called automatically before a search is actually performed, but you can also call it manually if desired. It will return a list of zero or more paramters that are missing.` open(self, opener=None, retries=2) `Open a connection to the webservice server, and request the URL. The return value is a "stream", which can be read calling the read(), readline() or readlines() methods. If you override this method, please make sure to call the missing_params() method before you try to send a request to the Web server.` parse_results(self, xml=None) `Get the result from the request, and instantiate the appropriate result class. This class will be populated with all the data from the XML object.` reset(self) `Reset all the parameter values for the object instance.` set_param(self, param, value) `Set the value of a query parameter` set_params(self, args) `Set one or several query parameters from a dictionary` Data descriptors inherited from yahoo.search._Search: app_id `Application ID (issued by Yahoo), same ass appid` appid `Application ID (issued by Yahoo)` cc_licenses `List of all supported Creative Commons licenses` countries `List of all supported county codes` debug_level `Set and modify the debug level` languages `List of all supported languages` regions `List of all supported region codes` subscriptions `List of all supported premium subscriptions` svc_name `Descriptive name of the service` svc_protocol `Service protocol (e.g. HTTP)` svc_server `Service server name or IP` svc_service `Service path` svc_version `Service version string` Data and other attributes inherited from yahoo.search._Search: METHOD = 'GET' PROTOCOL = 'http' SERVER = 'search.yahooapis.com' VERSION = 'V1' Data descriptors inherited from yahoo.search.debug.Debuggable: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class TagSearch(_MyWeb)
`` | `TagSearch - Search for tags by URL and/or by user This class implements a MyWeb2 service which allows you to find tags that have been associated with URLs by MyWeb 2.0 users. Allowed parameters are: url - If specified, only returns tags associated with this url. yahooid - The Yahoo! user who owns the folder being accessed. sort - The field by which the results should be sorted. Options are popularity (default), tag or date. reverse_sort - If set to 1, reverses the sort order. This has no effect on popularity searches. results - The number of results to return (1-50). start - The starting result position to return (1-based). The finishing position (start + results - 1) cannot exceed 1000. output - The format for the output result. If json or php is requested, the result is not XML parseable, so we will simply return the "raw" string. callback - The name of the callback function to wrap around the JSON data. Full documentation for this service is available at: http://developer.yahoo.net/myweb/V1/tagSearch.html`
| Method resolution order: TagSearch _MyWeb yahoo.search._Search yahoo.search.debug.Debuggable __builtin__.object Data and other attributes defined here: NAME = 'tagSearch' SERVICE = 'MyWebService' Methods inherited from yahoo.search._Search: __getattr__(self, name) __init__(self, app_id, opener=None, xml_parser=None, result_factory=None, debug_level=0, **args) `The app_id is a required argument, the Yahoo search services will not accept requests without a proper app_id. A valid app_id is a combination of 8 - 40 characters, matching the regexp "^[a-zA-Z0-9 _()\[\]*+\-=,.:\\@]{8,40}$" Please visit http://developer.yahoo.net/search/ to request an App ID for your own software or application. Four optional arguments can also be passed to the constructor: opener - Opener for urllib2 xml_parser - Function to parse XML (default: minidom) result_factory - Result factory class (default: none) debug_devel - Debug level (if any) All other "named" arguments are passed into as a dictionary to the set_params() method. The result factory is specific to the particular web service used, e.g. the different Yahoo Search services will each implement their own factory class. Both of these settings can be controlled via their respective install method (see below).` __setattr__(self, name, value) `# Implement the attribute handlers, to avoid confusion` encode_params(self) `URL encode the list of parameter values.` get_param(self, param) `Get the value of a query parameter, or the default value if unset` get_results(self, stream=None, xml_parser=None, close=True) `Read the stream (if provided) and either return the raw XML, or send the data to the provided XML parser for further processing. If no stream is provided, it will call the open() method using the default opener. The stream will be closed upon return from this method, unless the close=False is passed as an argument.` get_url(self, with_params=True) `Return the URL for this request object` get_valid_params(self) `Return a list of all valid parameters for this search` install_opener(self, opener) `Install a URL opener (for use with urllib2), overriding the default opener. This is rarely required.` install_result_factory(self, result_factory) `Install a python class (not an instance!) that should be used as a factory for creating result(s) objects.` install_xml_parser(self, xml_parser) `Install an XML parser that will be used for all results for this object. The parser is expected to "read" the data from the supplied stream argument. To uninstall the parser (e.g. to make sure we return raw XML data) simply call this method with an argument of None.` missing_params(self) `Validate that the search object is propertly setup with all required parameters etc. This is called automatically before a search is actually performed, but you can also call it manually if desired. It will return a list of zero or more paramters that are missing.` open(self, opener=None, retries=2) `Open a connection to the webservice server, and request the URL. The return value is a "stream", which can be read calling the read(), readline() or readlines() methods. If you override this method, please make sure to call the missing_params() method before you try to send a request to the Web server.` parse_results(self, xml=None) `Get the result from the request, and instantiate the appropriate result class. This class will be populated with all the data from the XML object.` reset(self) `Reset all the parameter values for the object instance.` set_param(self, param, value) `Set the value of a query parameter` set_params(self, args) `Set one or several query parameters from a dictionary` Data descriptors inherited from yahoo.search._Search: app_id `Application ID (issued by Yahoo), same ass appid` appid `Application ID (issued by Yahoo)` cc_licenses `List of all supported Creative Commons licenses` countries `List of all supported county codes` debug_level `Set and modify the debug level` languages `List of all supported languages` regions `List of all supported region codes` subscriptions `List of all supported premium subscriptions` svc_name `Descriptive name of the service` svc_protocol `Service protocol (e.g. HTTP)` svc_server `Service server name or IP` svc_service `Service path` svc_version `Service version string` Data and other attributes inherited from yahoo.search._Search: METHOD = 'GET' PROTOCOL = 'http' SERVER = 'search.yahooapis.com' VERSION = 'V1' Data descriptors inherited from yahoo.search.debug.Debuggable: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class UrlSearch(_MyWeb)
`` | `UrlSearch - Search for URLs with particular tags This class implements the MyWeb2 service to search for URLs that have been tagged by particular tags. Allowed parameters are: tag - The tag to search for. Multiple tags may be specified (e.g. ["tag1", "tag2"]). yahooid - The Yahoo! user who owns the folder being accessed. sort - The field by which the results should be sorted. date sorts most-recent-first, title and url are sorted alphabetically. reverse_sort - If set to 1, reverses the sort order. results - The number of results to return (1-50). start - The starting result position to return (1-based). The finishing position (start + results - 1) cannot exceed 1000. output - The format for the output result. If json or php is requested, the result is not XML parseable, so we will simply return the "raw" string. callback - The name of the callback function to wrap around the JSON data. Full documentation for this service is available at: http://developer.yahoo.net/myweb/V1/urlSearch.html`
| Method resolution order: UrlSearch _MyWeb yahoo.search._Search yahoo.search.debug.Debuggable __builtin__.object Data and other attributes defined here: NAME = 'urlSearch' SERVICE = 'MyWebService' Methods inherited from yahoo.search._Search: __getattr__(self, name) __init__(self, app_id, opener=None, xml_parser=None, result_factory=None, debug_level=0, **args) `The app_id is a required argument, the Yahoo search services will not accept requests without a proper app_id. A valid app_id is a combination of 8 - 40 characters, matching the regexp "^[a-zA-Z0-9 _()\[\]*+\-=,.:\\@]{8,40}$" Please visit http://developer.yahoo.net/search/ to request an App ID for your own software or application. Four optional arguments can also be passed to the constructor: opener - Opener for urllib2 xml_parser - Function to parse XML (default: minidom) result_factory - Result factory class (default: none) debug_devel - Debug level (if any) All other "named" arguments are passed into as a dictionary to the set_params() method. The result factory is specific to the particular web service used, e.g. the different Yahoo Search services will each implement their own factory class. Both of these settings can be controlled via their respective install method (see below).` __setattr__(self, name, value) `# Implement the attribute handlers, to avoid confusion` encode_params(self) `URL encode the list of parameter values.` get_param(self, param) `Get the value of a query parameter, or the default value if unset` get_results(self, stream=None, xml_parser=None, close=True) `Read the stream (if provided) and either return the raw XML, or send the data to the provided XML parser for further processing. If no stream is provided, it will call the open() method using the default opener. The stream will be closed upon return from this method, unless the close=False is passed as an argument.` get_url(self, with_params=True) `Return the URL for this request object` get_valid_params(self) `Return a list of all valid parameters for this search` install_opener(self, opener) `Install a URL opener (for use with urllib2), overriding the default opener. This is rarely required.` install_result_factory(self, result_factory) `Install a python class (not an instance!) that should be used as a factory for creating result(s) objects.` install_xml_parser(self, xml_parser) `Install an XML parser that will be used for all results for this object. The parser is expected to "read" the data from the supplied stream argument. To uninstall the parser (e.g. to make sure we return raw XML data) simply call this method with an argument of None.` missing_params(self) `Validate that the search object is propertly setup with all required parameters etc. This is called automatically before a search is actually performed, but you can also call it manually if desired. It will return a list of zero or more paramters that are missing.` open(self, opener=None, retries=2) `Open a connection to the webservice server, and request the URL. The return value is a "stream", which can be read calling the read(), readline() or readlines() methods. If you override this method, please make sure to call the missing_params() method before you try to send a request to the Web server.` parse_results(self, xml=None) `Get the result from the request, and instantiate the appropriate result class. This class will be populated with all the data from the XML object.` reset(self) `Reset all the parameter values for the object instance.` set_param(self, param, value) `Set the value of a query parameter` set_params(self, args) `Set one or several query parameters from a dictionary` Data descriptors inherited from yahoo.search._Search: app_id `Application ID (issued by Yahoo), same ass appid` appid `Application ID (issued by Yahoo)` cc_licenses `List of all supported Creative Commons licenses` countries `List of all supported county codes` debug_level `Set and modify the debug level` languages `List of all supported languages` regions `List of all supported region codes` subscriptions `List of all supported premium subscriptions` svc_name `Descriptive name of the service` svc_protocol `Service protocol (e.g. HTTP)` svc_server `Service server name or IP` svc_service `Service path` svc_version `Service version string` Data and other attributes inherited from yahoo.search._Search: METHOD = 'GET' PROTOCOL = 'http' SERVER = 'search.yahooapis.com' VERSION = 'V1' Data descriptors inherited from yahoo.search.debug.Debuggable: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`

Data
`` |  | __author__ = 'Leif Hedstrom <leif@ogre.com>' __date__ = 'Tue Feb 27 17:06:45 MST 2007' __revision__ = '$Id: myweb.py,v 1.5 2007/02/28 05:20:09 zwoop Exp $' __version__ = '$Revision: 1.5 $'

Author
`` |  | Leif Hedstrom <leif@ogre.com>