19 lines
577 B
Python
19 lines
577 B
Python
from web.library.models import *
|
|
from gdata.books.service import BookService
|
|
|
|
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q']
|
|
|
|
def get_book_loop():
|
|
service = BookService(source='Programvareverkstedet - Worblehat - 0.1a ')
|
|
while True:
|
|
input = raw_input('Enter ISBN number> ')
|
|
if input in exit_commands:
|
|
break
|
|
feed = service.search_by_keyword('isbn='+input)
|
|
if len(feed.entry) == 0:
|
|
print "No items found"
|
|
elif len(feed.entry) == 1:
|
|
print "Found one item: "+feed.entry[0].title.text
|
|
else:
|
|
print "Found several items, OWNOES!"
|