Vision Client#
Client#
Client for interacting with the Google Cloud Vision API.
-
class
google.cloud.vision.client.
Client
(project=None, credentials=None, http=None)[source]# Bases:
google.cloud.client.JSONClient
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 (
oauth2client.client.OAuth2Credentials
orNoneType
) – The OAuth2 Credentials to use for the connection owned by this client. If not passed (and if nohttp
object is passed), falls back to the default inferred from the environment. - http (
httplib2.Http
or class that definesrequest()
.) – An optional HTTP object to make requests. If not passed, anhttp
object is created that is bound to thecredentials
for the current object.
-
annotate
(image, features)[source]# Annotate an image to discover it’s attributes.
Parameters: Return type: Returns: List of annotations.
-
class
google.cloud.vision.client.
VisionRequest
(image, features)[source]# Bases:
object
Request container with image and features information to annotate.
Parameters: - features (list of
Feature
.) – The features that dictate which annotations to run. - image (bytes) – Either Google Cloud Storage URI or raw byte stream of image.
-
features
# List of Feature objects.
-
image
# Image object containing image content.
- features (list of
Connection#
Create / interact with Google Cloud Vision connections.
-
class
google.cloud.vision.connection.
Connection
(credentials=None, http=None)[source]# Bases:
google.cloud.connection.JSONConnection
A connection to Google Cloud Vision via the JSON REST API.
Parameters: - credentials (
oauth2client.client.OAuth2Credentials
) – (Optional) The OAuth2 Credentials to use for this connection. - http (
httplib2.Http
or class that definesrequest()
.) – (Optional) HTTP object to make requests. - api_base_url (string) – The base of the API call URL. Defaults to the value
Connection.API_BASE_URL
.
-
API_BASE_URL
= 'https://vision.googleapis.com'# The base of the API call URL.
-
API_URL_TEMPLATE
= '{api_base_url}/{api_version}{path}'# A template for the URL of a particular API call.
-
API_VERSION
= 'v1'# The version of the API, used in building the API call’s URL.
-
SCOPE
= ('https://www.googleapis.com/auth/cloud-platform',)# The scopes required for authenticating as a Cloud Vision consumer.
- credentials (