{"id":13446476,"url":"https://github.com/plamere/pyen","last_synced_at":"2025-03-21T06:31:23.117Z","repository":{"id":11256418,"uuid":"13657221","full_name":"plamere/pyen","owner":"plamere","description":"a simple, thin, un-opinionated python client for The Echo Nest API","archived":false,"fork":false,"pushed_at":"2016-01-17T14:24:45.000Z","size":274,"stargazers_count":56,"open_issues_count":2,"forks_count":19,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-17T04:02:40.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plamere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-17T18:22:15.000Z","updated_at":"2024-07-19T22:10:58.000Z","dependencies_parsed_at":"2022-09-16T03:51:42.225Z","dependency_job_id":null,"html_url":"https://github.com/plamere/pyen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plamere%2Fpyen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plamere%2Fpyen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plamere%2Fpyen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plamere%2Fpyen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plamere","download_url":"https://codeload.github.com/plamere/pyen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971188,"owners_count":20376784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T05:00:53.681Z","updated_at":"2025-03-21T06:31:22.794Z","avatar_url":"https://github.com/plamere.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Pyen - a Python client for The Echo Nest API\n\n## Description\n\nPyen is a thin, un-opinionated client library for The Echo Nest. It allows you to easily call Echo Nest methods. It manages API keys, rate limits and error responses in a sane fashion. \n\nPyen is a thin client. It doesn't try to represent Echo Nest items such as artists, songs and tracks as objects. Instead, it just lets you call the API method and gives you back a dictionary representation of the Echo Nest response.  If you prefer a fatter client that represents items as objects, and performs intelligent caching consider using [pyechonest](http://github.com/echonest/pyechonest) instead.\n\n## Installation\nIf you already have [Python](http://www.python.org/) and [pip](http://www.pip-installer.org/) on your system you can install\nthe library simply by running:\n\n    pip install pyen\n    \nOr you can download the distribution, unpack it and install in the usual fashion:\n\n    python setup.py install\n\n\n## Dependencies\n\n- [Requests](https://github.com/kennethreitz/requests) - pyen requires the requests package to be installed\n\n\n## Quick Start\nTo get started:\n\n- Install pyen\n- **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](http://developer.echonest.com).\n- **Set the API** key - you can do this one of two ways:\n   - Set an environment variable named `ECHO_NEST_API_KEY` to your API key\n   - or Explicitly call the Pyen constructor with your API key \n   \nGet the API key from your ECHO_NEST_API_KEY environment variable:\n   \n    en = pyen.Pyen()\n\nExplicitly set the API key:\n\n    en = pyen.Pyen(\"YOUR_API_KEY\")\n    \nCall the Pyen.get or the Pyen.post method to make API requests. Here's an example:\n\n    en = pyen.Pyen()  # create the EN api\n    response = en.get('artist/similar', name='weezer')\n\nExtract the output data from the response:\n\n    for artist in response['artists']:\n        print artist['id'], artist['name']\n        \nRefer to the [Echo Nest API documentation](http://developer.echonest.com/docs/v4) for details on the methods and parameters.\nNote that most API calls require a 'get' request but certain API method calls require a 'post'. Use the ```Pyen.get``` and\nthe ```Pyen.post``` where appropriate.  The Echo Nest API documentation indicates whether a `get` or a `post` is required.\n   \n## Quick Examples\n\nCreate a playlist with a seed artist of Weezer:\n\n    import pyen\n    en = pyen.Pyen()\n    \n    response = en.get('playlist/static', artist = 'Weezer', type = 'artist-radio')\n    for i, song in enumerate(response['songs']):\n        print \"%d %-32.32s %s\" % (i, song['artist_name'], song['title'])\n\n\nRandom walk through similar artists:\n\n    import pyen\n    import random\n\n    en = pyen.Pyen()\n    artist_name = 'The Beatles'\n    for i in xrange(500):\n        response = en.get('artist/similar', name =  artist_name)\n        print artist_name\n        for artist in response['artists']:\n            print '   --\u003e ', artist['name']\n        artist_name = random.choice(response['artists'])['name']\n\n\n\nCreate a taste profile (note the 'post' call):\n\n    import pyen\n\n    en = pyen.Pyen()\n\n    response = en.post('catalog/create', name='test-catalog', type='general')\n    print response['id']\n  \n## More Examples\nA full set of examples can be found in the [Pyen examples directory](https://github.com/plamere/pyen/tree/master/examples)  \n\n\n\n## Configuration\nYou can configure pyen by setting attributes. For example, to enable tracing of method calls and responses:\n    \n    en = pyen.Pyen()\n\nCurrent configuration parameters are:\n\n- **api_key** - your Echo Nest API key.\n- **auto_throttle** - (default True) - if True, pyen will throttle your API calls to match your rate limit.\n- **max_retries** - (default 5) - maximum number of retries when hitting the rate limit\n\n## Logging\n*(note, this logging behavior is temporarily disabled)*\n\nYou can turn tracing of requests and responses on and off by setting the `pyen` logger:\n\n        import logging\n        logging.getLogger('pyen').setLevel(logging.DEBUG)\n\n## Notes\n`pyen` will automatically detect your rate limit (by examining the response headers) and automatically throttle your API call rate to match that rate limit. If you turn off this behavior (by setting auto_throttle to False), pyen will throw an exception if you exceed the rate limit.\n\nWhen an error is detected(via the http response or via the Echo Nest return status code) a python exception is raised.\n\n## Reporting Issues\n\nIf you have suggestions, bugs or other issues specific to this library, file them [here](https://github.com/plamere/pyen/issues) or contact me\nat [paul@echonest.com](mailto:paul@echonest.com).\n\n## Version\n- 2.3 - 11/22/2013 - Added more examples\n- 2.2 - 11/15/2013 - Removed logging to avoid unicode error\n- 2.1 - 10/22/2013 - New configuration style\n- 2.0 - 10/21/2013 - New, more pythonic call style\n- 1.1 - 10/19/2013 - Better approach to auto throttling\n- 1.0 - 10/18/2013 - Initial release\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplamere%2Fpyen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplamere%2Fpyen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplamere%2Fpyen/lists"}