musixmatch-master/build/lib/musixmatch/ws.py
Go to the documentation of this file.
1 """
2 This is an utility module that provides a row musiXmatch web API interface.
3 Ideally it should be used like this:
4 
5 >>> import musixmatch
6 >>>
7 >>> try:
8 ... chart = musixmatch.ws.track.chart.get(country='it', f_has_lyrics=1)
9 ... except musixmatch.api.Error, e:
10 ... pass
11 """
12 from warnings import warn
13 import os
14 import musixmatch.api
15 __license__ = musixmatch.__license__
16 __author__ = musixmatch.__author__
17 
18 _version = os.environ.get('musixmatch_apiversion', None)
19 if not _version:
20  _version = '1.1'
21 else:
22  warn("Use of `musixmatch_apiversion' was deprecated in favour of `musixmatch_wslocation'", DeprecationWarning)
23 
24 location = os.environ.get('musixmatch_wslocation', 'http://api.musixmatch.com/ws/%s' % _version)
25 
26 artist = musixmatch.api.Method('artist')
27 album = musixmatch.api.Method('album')
28 track = musixmatch.api.Method('track')
29 tracking = musixmatch.api.Method('tracking')
30 matcher = musixmatch.api.Method('matcher')