2021年1月26日星期二

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

https://stackoverflow.com/questions/65912374/api-call-for-isnb January 27, 2021 at 11:07AM

没有评论:

发表评论