Package: audiolibrix
Audiolibrix Bindings for PythonA Python library forAudiolibrix's API v1 (via JSON format) to work with and order audiobooks from their catalogue.The bindings allow you to:Get the catalog of all booksGet single book details with links to previewsCreate order for multiple books at onceGet download links for given books previously bought by a userSetupSince the documentation to the Audiolibrix service is marked as confidential there is no immediate plan to release this package as open-source. For now, to install the package usingpip:pip install audiolibrixTo install from source, run:python setup.py installTo install viarequirementsfile from your project, add the following for the moment before updating dependencies:git+https://github.com/palosopko/audiolibrix-python.git#egg=audiolibrixUsageFirst off, you need to require the library and provide authentication information by providing your user handle and shared secret you got from the provider.import audiolibrix
audiolibrix.api_credentials = ('test', '0000000000000000')Getting catalogueis accomplished by callingaudiolibrix.Catalogue.all()with optional arguments for listing through catalogue and for type of returned items, which can be eitherfull(default),simpleorprice. The method returns dictionary with book IDs as keys andaudiolibrix.Bookobjects as values.audiolibrix.Catalogue.all(start=0, max=1, listing_type='full')Whengetting specific book detailsyou should use theaudiolibrix.Book.get()method call with book_id as an argument. The method returnsaudiolibrix.Bookobject.audiolibrix.Book.get(1)For reference, the beforementionedaudiolibrix.Bookobject has the following structure (using thefulllisting type when getting the catalogue or when running theaudiolibrix.Book.get()method directly).{
    'status': 'active',
    'publisher': {'id': 1, 'name': 'Tympanum'},
    'is_abridged': False,
    'description': '...',
    'language': 'cs',
    'title': 'Alenka v kraji div\xfa',
    'abstract': '...',
    'ean': '8594072279010',
    'published_on': datetime.datetime(2006, 10, 31, 0, 0),
    'price': {'currency': 'EUR', 'amount': Decimal('7.2')},
    'length_in_minutes': 180,
    'samples': {
        'mp3': {
            'links': [{
                'url': 'http://test.digiapi.com/Sample/1.mp3',
                'name': 'Alenka v kraji div\xfa'
            }],
            'mime_type': 'audio/mpeg',
            'format': 'MP3'
        }},
    'image': {'url': 'http://test.digiapi.com/Image/1.jpg', 'version': 1},
    'authors': ['Lewis Carroll'],
    'narrators': [u'Ji\u0159\xed Ornest'],
    'id': 1
}Tocreate a new orderyou need to runaudiolibrix.Order.create()with list of Audiolibrix's book IDs, your unique order_id and the email address of the buyer as arguments.audiolibrix.Order.create(
    books=[870, 980],
    order_id=1,
    user_email='example@example.com'
)The method returnsaudiolibrix.Orderobject which looks the following:{
    'books': [870, 980],
    'order_id': 1,
    'user_email': 'example@example.com'
}If you would liketo get order detailsyou callaudiolibrix.Order.get()with your order ID as the only argument. The method returns dictionary with book IDs as keys and dictionaries with the following attributes:format- File extension of download links, e.g. "mp3"mime_type- Mime type of download links, e.g. "audio/mpeg"links- List of dictionaries withurlandfilenameattributesContributingCheck for open issues or open a new issue for a feature request or a bug.Fork the repository and make your changes to the master branch (or branch off of it).Send a pull request.Changelogv0.3.4: 31/01/2021Allow setting default network request timeout and per-request timeouts as well. The timeouts are directly passed on torequestslibrary used to execute the network requests to Audiolibrix's API.v0.3.2: 08/01/2021Move over to GitHub and finally drop Python 2 support.v0.3.1: 09/10/2019Send proper JSON to Audiolibrix service.v0.3.0: 05/10/2019Python 3 compatibility and various project formal changes to make everything better.v0.2.2: 14/05/2019Fix raising exception when response from Audiolibrix's API is not a valid JSON.v0.2.1: 17/10/2015When ordering multiple products always order their IDs in an ascending order so that the client application does not have to (otherwise we getInvalidSignsatureerror).v0.2.0: 23/08/2015Version bump with fixes for incorrect URL creating when listing items and stripping whitespace with author handling. API endpoint URL set to Audiolibrix production servers.v0.1.0: 15/02/2015Initial version with support for main API methods with the omission of getting specific user's orders.