Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
81 views
in Technique[技术] by (71.8m points)

python 3.x - API Call for ISNB

I am using python 3 and have a list of ISNBs (134k) that I need to grab information on (publisher, title, etc). Right now, my firm is using https://isbndb.com/ and is subscribed to the pro plan. I am running code like so:

import requests

headers = {
    'accept': 'application/json',
    'Authorization': 'access-key',
    'Content-Type': 'application/json',
    'content-length': '3135',
    'Name': 'Access-Control-Allow-Origin'
}

data = {
  'isbns': '9781492666868,9781492666865'
}

response = requests.post('https://api2.isbndb.com/books/', headers=headers, data=data)

print(response.json())

This returns {'total': 0, 'requested': 1, 'data': []}. When I run with just one isbn i.e.

data = {
      'isbns': '9781492666868'
    }

This actually returns data for the specific ISBN. So it makes me thing that I am placing the ISNBS incorrectly, but i have tried a lot of different ways for that and nothing yields results.

In the sample that the webside gives, they give me a curl like so: curl -X POST "https://api2.isbndb.com/books" -H "accept: application/json" -H "Authorization: access-key" -H "Content-Type: application/json" -d "isbns=9781492666868,9781492666865"

Which i plugged into this website https://curl.trillworks.com/#python to get the equivalent in python which is how I got the code above.

I am just confused on why I am not getting results. Any help is much appreciated.

Thanks, J.Dykstra

question from:https://stackoverflow.com/questions/65912374/api-call-for-isnb

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...