Quantcast
Channel: The Echo Nest Developer Forum
Viewing all articles
Browse latest Browse all 1582

API Error 1|Ivalid key:

$
0
0

I copy and pasted the sample code below, as well as my api key not sure what is going on.

__author__ = 'Brian'
import sys
import urllib
import json
from pyechonest import playlist

def show_playlist(seed_artist):
    for s in playlist.basic(artist=seed_artist, type='artist-radio',
                buckets=['id:lyricfind-US'], results=10, limit=True):
        print '=================================================================='
        print s.title, 'by', s.artist_name
        print '=================================================================='
        show_lyrics(s)

def show_lyrics(s):
    lfid = s.get_foreign_id('lyricfind-US').replace('lyricfind-US:song:', '')
    url = 'http://test.lyricfind.com/api_service/lyric.do' +  \
        '?apikey=API_KEY' + \
        '&reqtype=default&output=json&trackid=elid:' + lfid
    f = urllib.urlopen(url)
    js = f.read()
    f.close()
    dict = json.loads(js)

    try:
        lyrics = dict['track']['lyrics']
        for line in lyrics.split('\r\n'):
            print line
        print
    except:
        print '(no lyrics)'

if __name__ == '__main__':
    # if len(sys.argv) > 1:
    #     show_playlist(' '.join(sys.argv[1:]))
    # else:
    #     print 'usage: %s artist name' % (sys.argv[0],)
    show_playlist("bob dylan")

I am getting this error message:

*Traceback (most recent call last):
  File "C:/Users/Brian Kane/Python files/EchoLyrics.py", line 41, in <module>
    show_playlist("bob dylan")
  File "C:/Users/Brian Kane/Python files/EchoLyrics.py", line 10, in show_playlist
    buckets=['id:lyricfind-US'], results=10, limit=True):
  File "C:\Users\Brian Kane\Python files\pyechonest\playlist.py", line 57, in basic
    result = util.callm("%s/%s" % ('playlist', 'basic'), kwargs)
  File "C:\Users\Brian Kane\Python files\pyechonest\util.py", line 203, in callm
    response_dict = get_successful_response(f)
  File "C:\Users\Brian Kane\Python files\pyechonest\util.py", line 122, in get_successful_response
    raise EchoNestAPIError(code, message, headers, http_status)
pyechonest.util.EchoNestAPIError: (u'Echo Nest API Error 1: 1|Invalid key: Unknown [HTTP 400]',)*

Viewing all articles
Browse latest Browse all 1582

Trending Articles