faset over fra Z3950 til google books
This commit is contained in:
18
python/google_interface.py
Normal file
18
python/google_interface.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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!"
|
||||
Reference in New Issue
Block a user