RPA.Cloud.Google

Google is a library for operating with Google API endpoints.

Installation

Usage requires the following steps:

  • Create a GCP project
  • Enable approriate APIs
  • Create credentials (OAuth or service account)
  • Install rpaframework-google package

Check the latest package version from PyPI.

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.

See library authentication examples for more information.

Basic usage examples

Python

from RPA.Cloud.Google import Google library = Google() service_account = '/path/to/service_account.json' library.init_vision(service_account) library.init_text_to_speech(service_account) response = library.detect_text('imagefile.png', 'result.json') library.synthesize_speech('I want this said aloud', target_file='said.mp3')

Robot Framework

*** Settings *** Library RPA.Cloud.Google *** Variables *** ${SERVICE_ACCOUNT} ${/}path${/}to${/}service_account.json ${BUCKET_NAME} testbucket12213123123 *** Tasks *** Upload a file into a new storage bucket [Setup] Init Storage ${SERVICE_ACCOUNT} Create Storage Bucket ${BUCKET_NAME} Upload Storage File ${BUCKET_NAME} ... ${/}path${/}to${/}file.pdf ... myfile.pdf @{files} List Storage Files ${BUCKET_NAME} FOR ${file} IN @{files} Log ${file} END

Importing

Library initialization

param service_account:
 path to service account
param vault_name:
 Robocorp vault name
param vault_secret_key:
 Robocorp secret key
param cloud_auth_type:
 "serviceaccount" or "token", defaults to "serviceaccount"