Vision Client#

Client#

Client for interacting with the Google Cloud Vision API.

class google.cloud.vision.client.Client(project=None, credentials=None, _http=None, _use_grpc=None)[source]#

Bases: google.cloud.client.ClientWithProject

Client to bundle configuration needed for API requests.

Parameters:
  • project (str) – the project which the client acts on behalf of. If not passed, falls back to the default inferred from the environment.
  • credentials (Credentials) – (Optional) The OAuth2 Credentials to use for this client. If not passed (and if no _http object is passed), falls back to the default inferred from the environment.
  • _http (Http) – (Optional) HTTP object to make requests. Can be any object that defines request() with the same interface as request(). If not passed, an _http object is created that is bound to the credentials for the current object. This parameter should be considered private, and could change in the future.
  • _use_grpc (bool) – (Optional) Explicitly specifies whether to use the gRPC transport (via GAX) or HTTP. If unset, falls back to the GOOGLE_CLOUD_DISABLE_GRPC environment variable. This parameter should be considered private, and could change in the future.
SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)#

The scopes required for authenticating as a Cloud Vision consumer.

batch()[source]#

Batch multiple images into a single API request.

Return type:google.cloud.vision.batch.Batch
Returns:Instance of Batch.
image(content=None, filename=None, source_uri=None)[source]#

Get instance of Image using current client.

Parameters:
  • content (bytes) – Byte stream of an image.
  • filename (str) – Filename to image.
  • source_uri (str) – URL or Google Cloud Storage URI of image.
Return type:

Image

Returns:

Image instance with the current client attached.