500 Error on DataAPI Example
Closed this issue · 4 comments
First, thanks for a great set of scripts. You've made this much, easier.
I have been trying to use the DataAPI example in the Readme. When I copy and paste your instructions (inserting my own keys) I get the following output:
from hathitrust_api import DataAPI
data_api = DataAPI(your_oauth_key, your_oauth_secret)
ocrtext = data_api.getpageocr('dul1.ark:/13960/t00z82c1q', 14)
HTTPError Traceback (most recent call last)
in ()
----> 1 ocrtext = data_api.getpageocr('dul1.ark:/13960/t00z82c1q', 14)
/Users/jbauer/Projects/oauth_create/hathitrust-api/hathitrust_api/data_api.pyc in getpageocr(self, doc_id, sequence)
146
147 """
--> 148 return self._makerequest('pageocr', doc_id, sequence=sequence)
149
150
/Users/jbauer/Projects/oauth_create/hathitrust-api/hathitrust_api/data_api.pyc in _makerequest(self, resource, doc_id, sequence, v, json, callback)
79
80 r = self.rsession.get(url, params=params)
---> 81 r.raise_for_status()
82
83 return r.content
/Users/jbauer/envs/oauth_create/lib/python2.7/site-packages/requests/models.pyc in raise_for_status(self)
771
772 if http_error_msg:
--> 773 raise HTTPError(http_error_msg, response=self)
774
775 def close(self):
HTTPError: 500 Server Error: Internal Server Error
I've tried inputting my keys as plain strings and unicode, and I also got new keys incase I had copied them incorrectly. I also installed requests-oauthlib from source rather than using the PYPI version.
Any suggestions are most welcome!
Oops, sorry @jabauer! I totally missed issue. It seems that the HathiTrust API has moved to version 2 with some backwards incompatible changes. I'll take a look and see if there is an easy fix.
@rlmv Did you ever figure out how to do authentication correctly with the new Data API? Trying and can't figure out from their docs what the various endpoints should be fore request, authorize, access.
@sckott I haven't had a chance to dig into it. From a quick look at the version 2 docs, it seems like the authentication should work with what is here. The data endpoints, however, need to be rewritten to match the new url scheme.
@toddgaron just made some changes which should get the data API wrapper back into working order.