Python client for the Echo Nest API

Overview

Pyechonest

Tap into The Echo Nest's Musical Brain for the best music search, information, recommendations and remix tools on the web.

Pyechonest is an open source Python library for the Echo Nest API. With Pyechonest you have Python access to the entire set of API methods including:

  • artist - search for artists by name, description, or attribute, and get back detailed information about any artist including audio, similar artists, blogs, familiarity, hotttnesss, news, reviews, urls and video.
  • song - search songs by artist, title, description, or attribute (tempo, duration, etc) and get detailed information back about each song, such as hotttnesss, audio_summary, or tracks.
  • track - upload a track to the Echo Nest and receive summary information about the track including key, duration, mode, tempo, time signature along with detailed track info including timbre, pitch, rhythm and loudness information.

Install

There are a few different ways you can install pyechonest:

  • Use setuptools: easy_install -U pyechonest
  • Download the zipfile from the releases page and install it.
  • Checkout the source: git clone git://github.com/echonest/pyechonest.git and install it yourself.

Getting Started

  • Install Pyechonest
  • Get an API key - to use the Echo Nest API you need an Echo Nest API key. You can get one for free at developer.echonest.com.
  • Set the API key - you can do this one of two ways:
  • set an environment variable named ECHO_NEST_API_KEY to your API key
  • Include this snippet of code at the beginning of your python scripts:
    from pyechonest import config
    config.ECHO_NEST_API_KEY="YOUR API KEY"
  • Check out the docs and examples below.

Examples

All examples assume you have already setup your api key!

Find artists that are similar to 'Bikini Kill':

from pyechonest import artist
bk = artist.Artist('bikini kill')
print "Artists similar to: %s:" % (bk.name,)
for similar_artist in bk.similar: print "\t%s" % (similar_artist.name,)

Search for artist:

from pyechonest import artist
weezer_results = artist.search(name='weezer')
weezer = weezer_results[0]
weezer_blogs = weezer.blogs
print 'Blogs about weezer:', [blog.get('url') for blog in weezer_blogs]

Get an artist by name:

from pyechonest import artist
a = artist.Artist('lady gaga')
print a.id

Get an artist by Musicbrainz ID:

from pyechonest import artist
a = artist.Artist('musicbrainz:artist:a74b1b7f-71a5-4011-9441-d0b5e4122711')
print a.name

Get the top hottt artists:

from pyechonest import artist
for hottt_artist in artist.top_hottt():
print hottt_artist.name, hottt_artist.hotttnesss

Search for songs:

from pyechonest import song
rkp_results = song.search(artist='radiohead', title='karma police')
karma_police = rkp_results[0]
print karma_police.artist_location
print 'tempo:',karma_police.audio_summary['tempo'],'duration:',karma_police.audio_summary['duration']

Get a song's audio_url and analysis_url:

from pyechonest import song
ss_results = song.search(artist='the national', title='slow show', buckets=['id:7digital-US', 'tracks'], limit=True)
slow_show = ss_results[0]
ss_tracks = slow_show.get_tracks('7digital-US')
print ss_tracks[0].get('preview_url')

-alt text

Comments
  • Migrate to Spotify | API key not allowed

    Migrate to Spotify | API key not allowed

    I expect that due to the migration of Echonest API to Spotify API, I'm now getting an error when I try to retrieve an audio_analysis object.

    But I'm not sure how or where to change the API I'm calling from the Echonest API to the Spotify API.

    The code is basically:

    from echonest.remix.audio import AudioAnalysis
    AudioAnalysis(str(track_md5))
    

    Will pyechonest and remix still work? And if so, where do I need to make configuration changes?

    I imagine I am missing something obvious.

    opened by MikeiLL 6
  • Visiting http://readme.md/ redirected me here

    Visiting http://readme.md/ redirected me here

    Some wysiwyg editors today auto-links xxx.yyy and that's the reason why I was brought here (Gmail in my case).

    I just thought that it would be very cool if it instead redirects you to a random readme page in Github.

    opened by yowmamasita 2
  • waffle.io Badge

    waffle.io Badge

    Merge this to receive a badge indicating the number of issues in the ready column on your waffle.io board at http://waffle.io/echonest/pyechonest

    This was requested by a real person on waffle.io, we're not trying to spam you.

    opened by waffleio 2
  • Song search not working

    Song search not working

    Hello,

    I get the following error when trying to execute example code for song.search found on this page: http://echonest.github.io/pyechonest/song.html

    Traceback (most recent call last):
      File "test.py", line 4, in <module>
        results = pyechonest.song.search(artist='shakira', title='she wolf', buckets=['id:7digital', 'tracks'], limit=True, results=1)
      File "build/bdist.linux-x86_64/egg/pyechonest/song.py", line 447, in search
      File "build/bdist.linux-x86_64/egg/pyechonest/util.py", line 208, in callm
    pyechonest.util.EchoNestIOError: Echo Nest Unknown Error
    
    opened by jleben 1
  • Request for API Key

    Request for API Key

    Hi,

    How to get the API key? When I click the link which is given on the installation page(http://developer.echonest.com/) I have got the error message "This site can’t be reached".

    Kindly advise?

    Thank you

    Regards Prabu M

    opened by prabu-mariappan 1
  • Artist object can't read foreign_id, even if requested

    Artist object can't read foreign_id, even if requested

    Looking through the code, I'm pretty sure that data must be coming back. It bounces an error if you try to limit without specifying an idspace in buckets arg. Maybe it's being filtered out by the "fix" function?

    opened by SafetyOrange 1
  • Last Example in the Readme

    Last Example in the Readme

    The last example isn't working for me.

    Traceback (most recent call last): File "song.py", line 5, in slow_show = ss_results[0] IndexError: list index out of range

    opened by eudaimonious 1
  • What's the meaning of echoprintstring?

    What's the meaning of echoprintstring?

    Hi,

    documentation links echoprintstring Track attribute to http://echoprint.me/ but I can't find explanation of what this data is supposed to represent.

    How can I decode echoprintstring value to meaningful representation?

    Thanks

    opened by ianstoic 1
  • eyeD3 version 0.7.x support

    eyeD3 version 0.7.x support

    diff --git a/examples/show_tempos.py b/examples/show_tempos.py
    --- a/examples/show_tempos.py
    +++ b/examples/show_tempos.py
    @@ -3,18 +3,18 @@
    
     import sys
     import os
    -import eyeD3
    +import eyed3.id3
     import tempo
    
    
     def show_tempo(mp3):
         "given an mp3, print out the artist, title and tempo of the song"
    -    tag = eyeD3.Tag()
    -    tag.link(mp3)
    -    my_tempo = tempo.get_tempo(tag.getArtist(), tag.getTitle())
    +    tag = eyed3.id3.Tag()
    +    tag.parse(mp3)
    +    my_tempo = tempo.get_tempo(tag.artist, tag.title)
         print 'File:  ', mp3
    -    print 'Artist:', tag.getArtist()
    -    print 'Title: ', tag.getTitle()
    +    print 'Artist:', tag.artist
    +    print 'Title: ', tag.title
         print 'Tempo: ', my_tempo
         print
    
    opened by nicfit 1
  • yup

    yup

    implementation of high_relevance on feeds. Tested: passed high_relevance True, False, checked the results ,checked that they are different and that the same results are returned by regular API call. Called w/o high_relevance set and checked that the behavior is the same as high_relevance=False

    opened by yfaktor 1
  • Factory function to create a catalog by name, avoiding the profile call.

    Factory function to create a catalog by name, avoiding the profile call.

    There doesn't appear to be a way to create a catalog in Pyechonest without making a profile call first. This patch adds a factory function to catalog.py, "create_catalog_by_name", that creates a catalog without the profile call, then returns an initialized Catalog object without any additional calls.

    opened by njl 0
  • Proposing a PR to fix a few small typos

    Proposing a PR to fix a few small typos

    Issue Type

    [x] Bug (Typo)

    Steps to Replicate and Expected Behaviour

    • Examine pyechonest/artist.py and observe ingteger, however expect to see integer.
    • Examine pyechonest/artist.py and observe hotttest, however expect to see hottest.

    Notes

    Semi-automated issue generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    To avoid wasting CI processing resources a branch with the fix has been prepared but a pull request has not yet been created. A pull request fixing the issue can be prepared from the link below, feel free to create it or request @timgates42 create the PR.

    https://github.com/timgates42/pyechonest/pull/new/bugfix_typos

    Thanks.

    opened by timgates42 0
  • Import Error about inconsistent indentation.

    Import Error about inconsistent indentation.

    >>> from pyechonest import catalog
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "...\Python\Python37\lib\site-packages\pyechonest\catalog.py", line 327
        if since:
                ^
    TabError: inconsistent use of tabs and spaces in indentation```
    
    opened by alegend4u 1
  • readme.md link redirect

    readme.md link redirect

    I think that the link "readme.md" should NOT redirect to this repo's readme.

    1. it's pointless
    2. causes confusion
    3. should be avoided, readme.md is a common filename and should now be a url.
    opened by haze 0
  • DynamicPlaylist instances are created, but no songs generated (Python 2.7)

    DynamicPlaylist instances are created, but no songs generated (Python 2.7)

    I'm having trouble getting the Dynamic Playlist object to work. I really want to be able to use a seed_catalog to generate the playlist, but any method to fetch songs e.g. get_lookahead_songs() returns None.

    standard_playlist1 = playlist.Playlist(seed_catalog=u'CAZZOPK15261351B73')
    print standard_playlist1
    
    >> <Dynamic Playlist - 96d0aed056df4e64997a16c670eae817>
    
    print standard_playlist1.get_lookahead_songs()
    
    >> None
    

    I have tried simple using an artist_id or artist argument, but it's not working.

    On the other hand, the static playlist works great through any generation method (artist, artist_id or seed catalog). Based on the documentation and the existence of a deprecated dynamic playlist, is this still something of a work in progress?

    opened by LiYChristopher 0
  • Song's foreign_id cache not filled properly, Song.get_foreign_id() not based on tracks

    Song's foreign_id cache not filled properly, Song.get_foreign_id() not based on tracks

    Hello,

    Thank you very much for the pyechonest library!!! It is awesome so far : )

    To reproduce: call Playlist.static(..., bucket=['id:spotify', 'tracks']) then find that someResultSong.get_foreign_id() returns None although someResultSong.cache['tracks'][0]['foreign_id'] is already filled.

    I also noticed that someResultSong.get_foreign_id() also tries to find the foreign_id using only bucket=['id:spotify'](ie.the catalog space) and looking into Song objects... Whereas the right for me would be to have bucket=['id:spotify','tracks'] and look into Song.tracks...

    Have a nice day!!! : )

    opened by myselfhimself 0
Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Harun Mbaabu Mwenda 46 Sep 1, 2022
Python API Client for Twitter API v2

?? Python Client For Twitter API v2 ?? Why Twitter Stream ? Twitter-Stream.py a python API client for Twitter API v2 now supports FilteredStream, Samp

Twitivity 31 Nov 19, 2022
Dns-Client-Server - Dns Client Server For Python

Dns-client-server DNS Server: supporting all types of queries and replies. Shoul

Nishant Badgujar 1 Feb 15, 2022
Raphtory-client - The python client for the Raphtory project

Raphtory Client This is the python client for the Raphtory project Install via p

Raphtory 5 Apr 28, 2022
Drcom-pt-client - Drcom Pt version client with refresh timer

drcom-pt-client Drcom Pt version client with refresh timer Dr.com Pt版本客户端 可用于网页认

null 4 Nov 16, 2022
Official Python client for the MonkeyLearn API. Build and consume machine learning models for language processing from your Python apps.

MonkeyLearn API for Python Official Python client for the MonkeyLearn API. Build and run machine learning models for language processing from your Pyt

MonkeyLearn 157 Nov 22, 2022
🖥️ Python - P1 Monitor API Asynchronous Python Client

??️ Asynchronous Python client for the P1 Monitor

Klaas Schoute 9 Dec 12, 2022
Python API Client for Close

Close API A convenient Python wrapper for the Close API. API docs: http://developer.close.com Support: [email protected] Installation pip install clos

Close 56 Nov 30, 2022
Python client for CoinPayments API

pyCoinPayments - Python API client for CoinPayments Updates This library has now been converted to work with python3 This is an unofficial client for

James 27 Sep 21, 2022
DEPRECATED - Official Python Client for the Discogs API

⚠️ DEPRECATED This repository is no longer maintained. You can still use a REST client like Requests or other third-party Python library to access the

Discogs 483 Dec 31, 2022
The Foursquare API client for Python

foursquare Python client for the foursquare API. Philosophy: Map foursquare's endpoints one-to-one Clean, simple, Pythonic calls Only handle raw data,

Mike Lewis 400 Dec 19, 2022
Python Client for Instagram API

This project is not actively maintained. Proceed at your own risk! python-instagram A Python 2/3 client for the Instagram REST and Search APIs Install

Facebook Archive 2.9k Dec 30, 2022
A Python Client for News API

newsapi-python A Python client for the News API. License Provided under MIT License by Matt Lisivick. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRAN

Matt Lisivick 281 Dec 29, 2022
SmartFile API Client (Python).

A SmartFile Open Source project. Read more about how SmartFile uses and contributes to Open Source software. Summary This library includes two API cli

SmartFile 19 Jan 11, 2022
Python client for the Socrata Open Data API

sodapy sodapy is a python client for the Socrata Open Data API. Installation You can install with pip install sodapy. If you want to install from sour

Cristina 368 Dec 9, 2022
A Python Tumblr API v2 Client

PyTumblr Installation Install via pip: $ pip install pytumblr Install from source: $ git clone https://github.com/tumblr/pytumblr.git $ cd pytumblr $

Tumblr 677 Dec 21, 2022
A super awesome Twitter API client for Python.

birdy birdy is a super awesome Twitter API client for Python in just a little under 400 LOC. TL;DR Features Future proof dynamic API with full REST an

Inueni 259 Dec 28, 2022
Cord Python API Client

Cord Python API Client The data programming platform for AI ?? Features Minimal low-level Python client that allows you to interact with Cord's API Su

Cord 52 Nov 25, 2022
Pure Python 3 MTProto API Telegram client library, for bots too!

Telethon ⭐️ Thanks everyone who has starred the project, it means a lot! Telethon is an asyncio Python 3 MTProto library to interact with Telegram's A

LonamiWebs 7.3k Jan 1, 2023