I'm only adding this for future readers because no other answer exists for a while now (I've also added a bounty):
from googleapiclient.discovery import build
# ...
service = build('vision', 'v1', developerKey=API_KEY, cache_discovery=False)
image_b64 = base64.b64encode(image_bytes).decode()
return service.images().annotate(body={
'requests': [{
'image': {
'content': image_b64
},
'features': [{
'type': 'DOCUMENT_TEXT_DETECTION',
'maxResults': 5,
}]
}]
}).execute()
This (python) sample obviously does not use the client in question, but this is how I went at it at the moment to do simple OCR.
You can change the features or the image specification to fit your needs.
GCLOUD_KEYFILE
environment variable equal to path to your .json key file. At least this is how it works in Ruby. – Nakilon