It looks like you're offline.
Open Library logo
additional options menu
Last edited by Mek
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

June 27, 2021 Edited by Mek Edited without comment.
June 27, 2021 Edited by Mek Edited without comment.
June 27, 2021 Edited by Mek reverted to revision 12
June 27, 2021 Edited by Mek Edited without comment.
November 30, 2010 Edited by raj add link to contact form