yahoo.search.audio (version 1.9, Tue Feb 27 14:08:31 MST 2007)index/home/leif/hack/pysearch/yahoo/search/audio.py
yahoo.search.audio - Audio Search services module
This module implements the the Audio Search web service, to do search
queries on various audio formats.
The supported classes of web searches are:
ArtistSearch - Information on a particular musical performer
AlbumSearch - Find information about albums
SongSearch - Provide information about songs
SongDownloadLocation - Find links to various providers of a song
PodcastSearch - Search for a Podcast site/feed
An application ID (appid) is always required when instantiating a search
object. In addition, each search class takes different set of parameters,
as defined by this table:
AlbumSearch ArtistSearch SongSearch SongDownloadLocation
----------- ------------ ---------- --------------------
type [X] [X] [X] .
results [X] [X] [X] [X]
start [X] [X] [X] [X]
artist [X] [X] [X] .
artistid [X] [X] [X] .
album [X] . [X] .
albumid [X] . [X] .
song . . [X] [X]
songid . . [X] .
source . . . [X]
output [X] [X] [X] [X]
callback [X] [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.audio import AlbumSearch
srch = AlbumSearch(app_id="YahooDemo")
srch.album = "Like"
srch.results = 40
for res in srch.parse_results():
print res.Artist
The PodcastSearch service takes a different set of parameters, see the
documentation for this class for further details.
Modules
types
yahoo
Classes
yahoo.search._CommonSearch(yahoo.search._Search)
PodcastSearch
_Audio(yahoo.search._Search)
AlbumSearch
ArtistSearch
SongDownloadLocation
SongSearch
class AlbumSearch(_Audio)
AlbumSearch - perform a Yahoo Album Search
This class implements the Album Search web service APIs, which allows
you to find information on music albums. Supported parameters are:
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.
artist - The artist or partial artist string to search for
(UTF-8 encoded).
artistid - The specific id for an artist.
album - The album name or partial album string to search for
(UTF-8 encoded).
albumid - The specific id for an album. Ids are internal to the
Music Search Service and will be returned with album
references. At least one of artist, artistid, album or
albumid is required.
type - The kind of search to submit:
* "all" returns results with all query terms.
* "any" resturns results with one or more of the
query terms.
* "phrase" returns results containing the query
terms as a phrase.
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/search/audio/V1/albumSearch.html
Method resolution order:
AlbumSearch
_Audio
yahoo.search._Search
yahoo.search.debug.Debuggable
__builtin__.object
Data and other attributes defined here:
NAME = 'albumSearch'
SERVICE = 'AudioSearchService'
Properties inherited from _Audio:
download_sources
List of all supported download sources
get = _get_download_sources(self)Get the list of all supported download sources.
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
Properties inherited from yahoo.search._Search:
app_id
Application ID (issued by Yahoo), same ass appid
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
appid
Application ID (issued by Yahoo)
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
cc_licenses
List of all supported Creative Commons licenses
get = _get_cc_licenses(self)Get the list of all supported CC licenses.
countries
List of all supported county codes
get = _get_countries(self)Get the list of all supported contry codes.
debug_level
Set and modify the debug level
get = _get_debug_level(self)Get the current debug level.
set = _set_debug_level(self, level)Set the new debug level to be used.
languages
List of all supported languages
get = _get_languages(self)Get the list of all supported languages.
regions
List of all supported region codes
get = _get_regions(self)Get the list of all supported region codes.
subscriptions
List of all supported premium subscriptions
get = _get_subscriptions(self)Get the list of supported premium subscriptions.
svc_name
Descriptive name of the service
get = _get_svc_name(self)Get the descriptive service name.
set = _set_svc_name(self, value)Set the descriptive service name.
svc_protocol
Service protocol (e.g. HTTP)
get = _get_svc_protocol(self)Get the service protocol (e.g. HTTP).
set = _set_svc_protocol(self, value)Set the service protocol (must be supported).
svc_server
Service server name or IP
get = _get_svc_server(self)Get the service server name or IP.
set = _set_svc_server(self, value)Set the service server name or IP.
svc_service
Service path
get = _get_svc_service(self)Get the URL path for the service.
set = _set_svc_service(self, value)Set the URL path for the service.
svc_version
Service version string
get = _get_svc_version(self)Get the service version string.
set = _set_svc_version(self, value)Set the service version string.
Data and other attributes inherited from yahoo.search._Search:
METHOD = 'GET'
PROTOCOL = 'http'
SERVER = 'search.yahooapis.com'
VERSION = 'V1'
Data and other attributes inherited from yahoo.search.debug.Debuggable:
__dict__ = <dictproxy object>dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Debuggable' objects>list of weak references to the object (if defined)
class ArtistSearch(_Audio)
ArtistSearch - perform a Yahoo Artist Search
This class implements the Artist Search web service APIs. Allowed
parameters are:
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.
artist - The artist or partial artist string to search for
(UTF-8 encoded).
artistid - The specific id for an artist. Ids are internal to
the Music Search Service and will be returned with
artist references. One of artist or artistid is
always required.
type - The kind of search to submit:
* "all" returns results with all query terms.
* "any" resturns results with one or more of the
query terms.
* "phrase" returns results containing the query
terms as a phrase.
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/search/audio/V1/artistSearch.html
Method resolution order:
ArtistSearch
_Audio
yahoo.search._Search
yahoo.search.debug.Debuggable
__builtin__.object
Data and other attributes defined here:
NAME = 'artistSearch'
SERVICE = 'AudioSearchService'
Properties inherited from _Audio:
download_sources
List of all supported download sources
get = _get_download_sources(self)Get the list of all supported download sources.
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
Properties inherited from yahoo.search._Search:
app_id
Application ID (issued by Yahoo), same ass appid
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
appid
Application ID (issued by Yahoo)
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
cc_licenses
List of all supported Creative Commons licenses
get = _get_cc_licenses(self)Get the list of all supported CC licenses.
countries
List of all supported county codes
get = _get_countries(self)Get the list of all supported contry codes.
debug_level
Set and modify the debug level
get = _get_debug_level(self)Get the current debug level.
set = _set_debug_level(self, level)Set the new debug level to be used.
languages
List of all supported languages
get = _get_languages(self)Get the list of all supported languages.
regions
List of all supported region codes
get = _get_regions(self)Get the list of all supported region codes.
subscriptions
List of all supported premium subscriptions
get = _get_subscriptions(self)Get the list of supported premium subscriptions.
svc_name
Descriptive name of the service
get = _get_svc_name(self)Get the descriptive service name.
set = _set_svc_name(self, value)Set the descriptive service name.
svc_protocol
Service protocol (e.g. HTTP)
get = _get_svc_protocol(self)Get the service protocol (e.g. HTTP).
set = _set_svc_protocol(self, value)Set the service protocol (must be supported).
svc_server
Service server name or IP
get = _get_svc_server(self)Get the service server name or IP.
set = _set_svc_server(self, value)Set the service server name or IP.
svc_service
Service path
get = _get_svc_service(self)Get the URL path for the service.
set = _set_svc_service(self, value)Set the URL path for the service.
svc_version
Service version string
get = _get_svc_version(self)Get the service version string.
set = _set_svc_version(self, value)Set the service version string.
Data and other attributes inherited from yahoo.search._Search:
METHOD = 'GET'
PROTOCOL = 'http'
SERVER = 'search.yahooapis.com'
VERSION = 'V1'
Data and other attributes inherited from yahoo.search.debug.Debuggable:
__dict__ = <dictproxy object>dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Debuggable' objects>list of weak references to the object (if defined)
class PodcastSearch(yahoo.search._CommonSearch)
PodcastSearch - perform a Yahoo Podcast Search
This class implements the Podcast Search web service APIs. Allowed
parameters are:
query - The query to search for (UTF-8 encoded).
type - The kind of search to submit (all, any or phrase).
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.
format - Specifies the kind of audio file to search for.
adult_ok - The service filters out adult content by default.
Enter a 1 to allow adult content.
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.
Supported formats are
all - All formats (default)
aiff - AIFF
midi - MIDI file
mp3 - MP3 (MPEG-3) format
msmedia - Microsoft media
quicktime - Apple QuickTime
realmedia - Real media
wav - Wave file
other - Other
Full documentation for this service is available at:
http://developer.yahoo.net/audio/V1/podcastSearch.html
Method resolution order:
PodcastSearch
yahoo.search._CommonSearch
yahoo.search._Search
yahoo.search.debug.Debuggable
__builtin__.object
Data and other attributes defined here:
NAME = 'podcastSearch'
SERVICE = 'AudioSearchService'
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
Properties inherited from yahoo.search._Search:
app_id
Application ID (issued by Yahoo), same ass appid
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
appid
Application ID (issued by Yahoo)
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
cc_licenses
List of all supported Creative Commons licenses
get = _get_cc_licenses(self)Get the list of all supported CC licenses.
countries
List of all supported county codes
get = _get_countries(self)Get the list of all supported contry codes.
debug_level
Set and modify the debug level
get = _get_debug_level(self)Get the current debug level.
set = _set_debug_level(self, level)Set the new debug level to be used.
languages
List of all supported languages
get = _get_languages(self)Get the list of all supported languages.
regions
List of all supported region codes
get = _get_regions(self)Get the list of all supported region codes.
subscriptions
List of all supported premium subscriptions
get = _get_subscriptions(self)Get the list of supported premium subscriptions.
svc_name
Descriptive name of the service
get = _get_svc_name(self)Get the descriptive service name.
set = _set_svc_name(self, value)Set the descriptive service name.
svc_protocol
Service protocol (e.g. HTTP)
get = _get_svc_protocol(self)Get the service protocol (e.g. HTTP).
set = _set_svc_protocol(self, value)Set the service protocol (must be supported).
svc_server
Service server name or IP
get = _get_svc_server(self)Get the service server name or IP.
set = _set_svc_server(self, value)Set the service server name or IP.
svc_service
Service path
get = _get_svc_service(self)Get the URL path for the service.
set = _set_svc_service(self, value)Set the URL path for the service.
svc_version
Service version string
get = _get_svc_version(self)Get the service version string.
set = _set_svc_version(self, value)Set the service version string.
Data and other attributes inherited from yahoo.search._Search:
METHOD = 'GET'
PROTOCOL = 'http'
SERVER = 'search.yahooapis.com'
VERSION = 'V1'
Data and other attributes inherited from yahoo.search.debug.Debuggable:
__dict__ = <dictproxy object>dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Debuggable' objects>list of weak references to the object (if defined)
class SongDownloadLocation(_Audio)
SongDownloadLocation - find places to download songs
This class implements the Song Download Location web service APIs.
Allowed parameters are:
songid - The specific id for a song.
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.
source - The source of the download. You may specify multiple
values, e.g. ["yahoo", "itunes"].
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.
Full documentation for this service is available at:
http://developer.yahoo.net/search/audio/V1/artistSearch.html
Method resolution order:
SongDownloadLocation
_Audio
yahoo.search._Search
yahoo.search.debug.Debuggable
__builtin__.object
Data and other attributes defined here:
NAME = 'songDownloadLocation'
SERVICE = 'AudioSearchService'
Properties inherited from _Audio:
download_sources
List of all supported download sources
get = _get_download_sources(self)Get the list of all supported download sources.
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
Properties inherited from yahoo.search._Search:
app_id
Application ID (issued by Yahoo), same ass appid
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
appid
Application ID (issued by Yahoo)
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
cc_licenses
List of all supported Creative Commons licenses
get = _get_cc_licenses(self)Get the list of all supported CC licenses.
countries
List of all supported county codes
get = _get_countries(self)Get the list of all supported contry codes.
debug_level
Set and modify the debug level
get = _get_debug_level(self)Get the current debug level.
set = _set_debug_level(self, level)Set the new debug level to be used.
languages
List of all supported languages
get = _get_languages(self)Get the list of all supported languages.
regions
List of all supported region codes
get = _get_regions(self)Get the list of all supported region codes.
subscriptions
List of all supported premium subscriptions
get = _get_subscriptions(self)Get the list of supported premium subscriptions.
svc_name
Descriptive name of the service
get = _get_svc_name(self)Get the descriptive service name.
set = _set_svc_name(self, value)Set the descriptive service name.
svc_protocol
Service protocol (e.g. HTTP)
get = _get_svc_protocol(self)Get the service protocol (e.g. HTTP).
set = _set_svc_protocol(self, value)Set the service protocol (must be supported).
svc_server
Service server name or IP
get = _get_svc_server(self)Get the service server name or IP.
set = _set_svc_server(self, value)Set the service server name or IP.
svc_service
Service path
get = _get_svc_service(self)Get the URL path for the service.
set = _set_svc_service(self, value)Set the URL path for the service.
svc_version
Service version string
get = _get_svc_version(self)Get the service version string.
set = _set_svc_version(self, value)Set the service version string.
Data and other attributes inherited from yahoo.search._Search:
METHOD = 'GET'
PROTOCOL = 'http'
SERVER = 'search.yahooapis.com'
VERSION = 'V1'
Data and other attributes inherited from yahoo.search.debug.Debuggable:
__dict__ = <dictproxy object>dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Debuggable' objects>list of weak references to the object (if defined)
class SongSearch(_Audio)
AlbumSearch - perform a Yahoo Album Search
This class implements the Album Search web service APIs, which allows
you to find information on music albums. Supported parameters are:
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.
artist - The artist or partial artist string to search for
(UTF-8 encoded).
artistid - The specific id for an artist.
album - The album name to search for (UTF-8 encoded).
albumid - The specific id for an album.
song - The song title to search for (UTF-8 encoded).
songid - The specific id for a song. At least one of artist,
artistid, album, albumid, song or songid is required.
type - The kind of search to submit:
* "all" returns results with all query terms.
* "any" resturns results with one or more of the
query terms.
* "phrase" returns results containing the query
terms as a phrase.
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/search/audio/V1/songSearch.html
Method resolution order:
SongSearch
_Audio
yahoo.search._Search
yahoo.search.debug.Debuggable
__builtin__.object
Data and other attributes defined here:
NAME = 'songSearch'
SERVICE = 'AudioSearchService'
Properties inherited from _Audio:
download_sources
List of all supported download sources
get = _get_download_sources(self)Get the list of all supported download sources.
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
Properties inherited from yahoo.search._Search:
app_id
Application ID (issued by Yahoo), same ass appid
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
appid
Application ID (issued by Yahoo)
get = _get_app_id(self)Get the application ID.
set = _set_app_id(self, app_id)Set the application ID, which is required.
cc_licenses
List of all supported Creative Commons licenses
get = _get_cc_licenses(self)Get the list of all supported CC licenses.
countries
List of all supported county codes
get = _get_countries(self)Get the list of all supported contry codes.
debug_level
Set and modify the debug level
get = _get_debug_level(self)Get the current debug level.
set = _set_debug_level(self, level)Set the new debug level to be used.
languages
List of all supported languages
get = _get_languages(self)Get the list of all supported languages.
regions
List of all supported region codes
get = _get_regions(self)Get the list of all supported region codes.
subscriptions
List of all supported premium subscriptions
get = _get_subscriptions(self)Get the list of supported premium subscriptions.
svc_name
Descriptive name of the service
get = _get_svc_name(self)Get the descriptive service name.
set = _set_svc_name(self, value)Set the descriptive service name.
svc_protocol
Service protocol (e.g. HTTP)
get = _get_svc_protocol(self)Get the service protocol (e.g. HTTP).
set = _set_svc_protocol(self, value)Set the service protocol (must be supported).
svc_server
Service server name or IP
get = _get_svc_server(self)Get the service server name or IP.
set = _set_svc_server(self, value)Set the service server name or IP.
svc_service
Service path
get = _get_svc_service(self)Get the URL path for the service.
set = _set_svc_service(self, value)Set the URL path for the service.
svc_version
Service version string
get = _get_svc_version(self)Get the service version string.
set = _set_svc_version(self, value)Set the service version string.
Data and other attributes inherited from yahoo.search._Search:
METHOD = 'GET'
PROTOCOL = 'http'
SERVER = 'search.yahooapis.com'
VERSION = 'V1'
Data and other attributes inherited from yahoo.search.debug.Debuggable:
__dict__ = <dictproxy object>dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Debuggable' objects>list of weak references to the object (if defined)
Data
DOWNLOAD_SOURCES = {'artistdirect': '', 'audiolunchbox': '', 'buymusic': '', 'dmusic': '', 'emusic': '', 'epitonic': '', 'garageband': '', 'itunes': '', 'livedownloads': '', 'mapster': '', ...}
__author__ = 'Leif Hedstrom <leif@ogre.com>'
__date__ = 'Tue Feb 27 14:08:31 MST 2007'
__revision__ = '$Id: audio.py,v 1.9 2007/02/28 05:20:09 zwoop Exp $'
__version__ = '$Revision: 1.9 $'
Author
Leif Hedstrom <leif@ogre.com>