abbyy / ocrsdk.com

ABBYY Cloud OCR SDK
http://ocrsdk.com/github
Apache License 2.0
504 stars 483 forks source link

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://cloud.ocrsdk.com/processImage?exportFormat=xml%2CpdfTextAndImages&language=English #75

Open laneschmidt opened 5 years ago

laneschmidt commented 5 years ago

I used two methods:

  1. the following code (from the ABBYY PyPi page at https://pypi.org/project/ABBYY/):
from ABBYY import CloudOCR

ocr = CloudOCR(application_id=<my_app_id>, password=<my_abbyy_password>)
pdf = open('blah.pdf', 'rb')
file = {pdf.name: pdf}

result = ocr.process_and_download(
  file,
  exportFormat='xml,pdfTextAndImages',
  language='English'
)

print(result)

the value used above in <my_app_id> was the value found on the Application Settings page of my Abbyy Cloud OCR SDK Console, as described here: https://abbyy.technology/en:products:cloud-ocr:where_can_i_find_the_appid

which resulted in

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://cloud.ocrsdk.com/processImage?exportFormat=xml%2CpdfTextAndImages&language=English
  1. the method suggested at this page (https://www.ocrsdk.com/documentation/quick-start-guide/python-ocr-sdk/) and running the command (after setting ABBYY_APPID and ABBY_PWD):

python process.py -pdf blah.pdf result.txt

which results in

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://cloud-westus.ocrsdk.com/processImage?language=English&exportFormat=pdfSearchable

My guess would be some sort of authentication issue. I'm not sure if I'm using the right application ID, but I'm not sure what else I'd use.

Dmitry-Me commented 5 years ago

Most likely you either failed to specify a password or used the wrong password. Where does the password you use come from?

laneschmidt commented 5 years ago

I used the password given through email received by Abbyy. I tried getting a new password from Abbyy but that didn't work. I moved on to use another cloud OCR service so I won't be coming back to this issue.