Installing the client libraries
Java
If you are using Maven, add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.37.1</version>
</dependency>
If you are using Gradle, add this to your dependencies:
compile 'com.google.cloud:google-cloud-storage:1.37.1'
If you are using SBT, add this to your dependencies:
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "1.37.1"
If you're using VS Code, IntelliJ, or Eclipse, you can add client libraries to your project using these IDE plugins:
Besides adding client libraries, the plugins provide additional functionality, such as service account key management. Refer to the documentation for each plugin for more details.
Node.js
To install the Node.js client library:
npm install --save @google-cloud/vision
Python
The Python client library has been updated to reflect the latest changes to the Cloud Vision API Beta. These changes are not backwards-compatible with client libraries older than version 0.30.1.
To install the Python client library:
pip install --upgrade google-cloud-vision
Using the client library
To run the client library on your local workstation:
- Install the Google Cloud CLI.
- Create a service account.
- Create a service account key and download the JSON key file.
Set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to point to your service account key file. This enables your client libraries to use Application Default Credentials (ADC).export GOOGLE_APPLICATION_CREDENTIALS=path-to-key-file
Authenticate by running the following command:
gcloud auth login
For information about authenticating in other environments, see the Google Cloud Platform Auth Guide.