Click here to skip to this page's main content.

Internet Archive logo

Site Search

Site Search
Last edited by Anand Chitipothu
February 26, 2013 | History

Writing Open Library Bots

First, create a Bot account, ending with "Bot". Example bots include WorkBot, ImportBot and ToCb0t. Ending with "Bot" allows the bot edits to be filtered in Recent Changes. (Since bots tend to repeat the same small operation with high frequency, they would overwhelm the list if shown alongside edits by humans.)

In order for your Bot to get write access to the OL API, your bot account must be a member of the API usergroup. Please write to us and tell us as much as you can about what your bot will do, and if everything looks good, we'll go ahead and add you to the API usergroup.

Your Bot will need to use the Open Library API to read from or write to an Open Library instance. There is documentation in the source available at GitHub: http://github.com/internetarchive/openlibrary/blob/master/openlibrary/api.py

ol = OpenLibrary('http://0.0.0.0:8080') # use dev instance
ol.login(username, password) # or use ol.autologin() to load from ~/.olrc
data = ol.get(key)
ol.save(key, data, comment)

You can save thing with key-value pairs and add comments for edits your Bot makes. A loop would look like find book, add identifier, save.

Querying for things:

things = ol.query({'key1': 'value1', 'key2': 'value2'})

Examples and source code:

History Created June 11, 2010 · 11 revisions

February 26, 2013 Edited by Anand Chitipothu Fixed OL github repo URL (tx John Shutt)
January 4, 2012 Edited by Edward Betts fix link to Ben's Goodread bot, thanks goes to Tom Morris
May 3, 2011 Edited by George added a link to oclcBot
January 31, 2011 Edited by George Added AMillarBot
June 11, 2010 Created by mangtronix Start of docs on writing bots