-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
50 lines (28 loc) · 2.41 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ISBNdbpy - Copyright 2010 Ruiwen Chua <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Set your ISBNdb API key in constants.py, or otherwise pass it in as a keyword argument ('apikey') when constructing a Request object.
Getting Started
The Request object is the base level for using this wrapper.
Arguments to the Request constructor include: collection, index and value.
These arguments correspond to the data collection, index1 and value1 as defined at: http://isbndb.com/docs/api/50-collections.html
Eg. the 'collection' argument to the constructor can be one of 'books', 'subjects', 'categories', 'authors', 'publishers'
EXAMPLE:
>>> import isbndbpy
>>> req = isbndbpy.Request('books', 'combined', 'makers by cory doctorow')
>>> req.send()
<addinfourl at 142601676 whose fp = <socket._fileobject object at 0x87d396c>>
>>> req.send().read()
'<?xml version="1.0" encoding="UTF-8"?>\n\n<ISBNdb server_time="2010-07-19T11:18:47Z">\n<BookList total_results="1" page_size="10" page_number="1" shown_results="1">\n<BookData book_id="makers_a01" isbn="0765312794" isbn13="9780765312792">\n<Title>Makers</Title>\n<TitleLong></TitleLong>\n<AuthorsText>Cory Doctorow, </AuthorsText>\n<PublisherText publisher_id="tor_books">Tor Books</PublisherText>\n</BookData>\n</BookList>\n</ISBNdb>\n'
>>> req.response()
<isbndbpy.Response instance at 0x87f3dcc>
>>> req.response().raw()
'<?xml version="1.0" encoding="UTF-8"?>\n\n<ISBNdb server_time="2010-07-19T11:19:20Z">\n<BookList total_results="1" page_size="10" page_number="1" shown_results="1">\n<BookData book_id="makers_a01" isbn="0765312794" isbn13="9780765312792">\n<Title>Makers</Title>\n<TitleLong></TitleLong>\n<AuthorsText>Cory Doctorow, </AuthorsText>\n<PublisherText publisher_id="tor_books">Tor Books</PublisherText>\n</BookData>\n</BookList>\n</ISBNdb>\n'