Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Music Story Python SDK

Project Description
Music Story Python SDK

Version : 0.1
For Python : 2.7 and 3.3
Licence: BSD

The SDK written allows a simplified use of the API Music Story (

It provides basis functionalities such as the Oauth authentification, the search and retrieval of Objects, connectors, and the exploration of results.

It can also serve as a basis for the development of libraries with more advanced functionalities.


pip install music_story


The authentication is done during the instancing of the MusicStoryAPI class.
It is necessary in order to identify yourself to provide your "consumer_key" and "consumer_secret" keys.

If you don't specify your access tokens: "token" and "token_secret", the authentication will take care of getting new ones.


# First connection
api = MusicStoryApi('you key here', 'your secret here')

token = api.token
token_secret = api.token_secret

# save this for later usage, then on next connection :
api = MusicStoryApi('you key here', 'your secret here', token, token_secret)

Retrieval of an object by an ID

The function that allows this operation is the function::

api.get(object_name, object_id)

Refer to the online documentation ( to know the list of Music Story objects available.


# retrieval of the genre with the ID 66
genre = api.get("genre", 66)
## Electro

The object sent back will be an instance of the "MusicStoryObject" class.

The data of the data retrieved will be accessible as regular attributs. You
can lookup for all the attributes names available as API data using
the `fields` attributs. It's only available AFTER you made the query.

You can specify you need editorial fields by listing them in `editorial_fields`::

artist = api.get("artist", id=1, editorial_fields=['country'])
## England

You may also specify the language code of the lang you want to get the results in::

artist = api.get("artist", id=1, editorial_fields=['country'], lang='fr')

But be aware the API as some fields that are not available in other languages
than the default (english).

Search for the objects

The search for objects is done via the method::, **filters)

Filters are listed in the MusicStoryAPI doc, and can be text patterns or date

By default the number of results per page is 10 and is fixed as a maximum of 100.


# search for the album versions which includes the word
# "love" in the name and is of the "live" type
releases ='release', type='Live', title='love')

# get the first result in the list :
rel = releases[0] # get item 0 from the current page
## "228095"
## 1

# results are iterable queryset...
r1, r2, r3 = releases[12:15]
## Such Is Love

# ...but be aware it will make queries every time it needs to paginate !
# So you can make this and iterate thought the whole queryset :
for release in releases:
# And it will paginate automatically for you, but will need to make a query
# for each new page it loads.

Some explicit methods are put at your disposition such as the iterator functions "next()", "prev()","hasNext()","hasPrev()" if you want to controle pagination manually.


It is possible to carry out a request of the connector type on a "MusicStoryObject" by using the method::

api.connector(object_name, **filters)

Refer to the online documentation ( to know the list of connectors of the available object.

The result is of the same type as for a search request::

genre = api.get('genre', 64)
artistes = genre.connector('artists', name='Tommy')
## Tommy Bolin
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
music_story-0.1.tar.gz (7.3 kB) Copy SHA256 Checksum SHA256 Source Feb 6, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting