RPA.Cloud.Google
Google is a library for operating with Google API endpoints.
Usage requires the following steps:
- Create a GCP project
- Enable approriate APIs
- Create credentials (OAuth or service account)
- Install rpaframework-google package
Google authentication
Authentication for Google is set with service account JSON file which can be given to the library in three different ways or with OAuth2 token, which is used for OAuth authentication.
Methods when using service account:
- Method 1 as environment variables,
GOOGLE_APPLICATION_CREDENTIALS
with path to service account file. - Method 2 as keyword parameter to
Init Storage
for example. - Method 3 as Robocorp vault secret. The vault name and secret key name needs to be given in library init
or with keyword
Set Robocorp Vault
. Secret value should contain JSON file contents.
Method 1. service account using environment variable
Method 2. service account with keyword parameter
Method 3. setting Robocorp Vault in the library init
Method 3. setting Robocorp Vault with keyword
Methods when using OAuth token:
- Method 1 as keyword parameter
token_file
toInit Storage
for example. - Method 2 as Robocorp vault secret. The vault name and secret key name needs to be given in library init
or with keyword
Set Robocorp Vault
. Secret value should contain JSON file contents.
Method 1. The Google Apps Script and Google Drive services are authenticated using this method.
Method 2. setting Robocorp Vault in the library init
Creating and using OAuth token file
The token file can be created using credentials.json by running command:
rpa-google-oauth --credentials <filepath> --service drive
or
rpa-google-oauth --credentials <filepath> --scopes drive.appdata,drive.file,drive.install
This will start web based authentication process, which outputs the token at the end.
Token could be stored into Robocorp Vault
.
Example Vault content.
Using the Vault.
Installation
This library, RPA.Cloud.Google
is available via rpaframework-google package.
Check the latest package version from PyPI.
Examples
Robot Framework
Python