Sunday, December 8, 2013

Feature of the Week: Python Client for the BibSonomy REST-API

This week's feature touches several activities that are currently happening:
  1. We are moving our development infrastructure to Bitbucket.
  2. We are reanimating the Python client for the REST API.
  3. We are developing a CKAN extension.
These activities are somehow related, at least I am bound to mention them all three in this post.

Moving to Bitbucket

As an important step to further open BibSonomy for other developers and ease the development of applications that use the BibSonomy infrastructure, we are migrating to Bitbucket until the next release (which is planned for end of January). At the moment, several extensions and plugins for PHPTypo3Android, etc. are moved to the new Bitbucket BibSonomy account.  Other code will follow during the next weeks, in particular the releases currently available at dev.bibsonomy.org.

Python Client

The old Python client for the BibSonomy REST API was no longer maintained and was not really used (and thus not tested) by a real use-case. Since we now have the need for a Python client (see next section), we started the development of a new client.

As a first use-case to test the code and implement some nice functionality, we wrote the small script onefile.py which allows you to download all your posts from BibSonomy into one HTML file which you can use in offline-mode. This is handy for situations where you don't have an internet connection, in particular, since the script allows you to also download all your documents! The documentation which you can access with --help shows you what is possible:

usage: onefile.py [-h] [-u USER] [-t TAG [TAG ...]] [-d]
                  [--bookmark-file BFILE] [--publication-file BFILE]
                  [--css-file CSSFILE] [--no-bookmarks] [--no-publications]
                  [--test]
                  user apikey

Download posts from BibSonomy and store them in a file.

positional arguments:
  user                  BibSonomy user name
  apikey                corresponding API key (get it from
                        http://www.bibsonomy.org/settings?selTab=1)

optional arguments:
  -h, --help            show this help message and exit
  -u USER, --user USER  return posts for USER instead of user
  -t TAG [TAG ...], --tags TAG [TAG ...]
                        return posts that contain the given tags
  -d, --documents       download documents for publications
  --bookmark-file BFILE
                        file name for bookmarks
  --publication-file BFILE
                        file name for publications
  --css-file CSSFILE    write CSS to file
  --no-bookmarks        do not write bookmarks
  --no-publications     do not write publications
  --test                use test data

We are currently very active in improving the script, therefore feedback and suggestions are highly welcome.

CKAN Extension

CKAN is a web-based platform for scientists to manage and publish dataset metadata as Linked Open Data. To better connect datasets with the publications that describe and use them, we are currently implementing a CKAN extension that allows users to connect their datasets with the corresponding publications from BibSonomy. A mockup screenshot shows how we intend to integrate publications into CKAN:


We think that these are good news for all developers, since rapid development of BibSonomy-based applications with Python is now becoming much easier. Feedback and contributions are welcome - the source code is open and free for everybody.



Happy developing!