Overview

This package provides a simple wrapper around Google APIs such as Cloud Compute, IAM, Deployment Manager, and other
cloud-related APIs.

It is used internally by Infolinks for provisioning and deployments, and has proven useful, so we’ve decided to
share it! Note that this is still work in progress - our internal version is currently more comprehensive in its
coverage of Google’s APIs than this version; we will slowly transition more & more APIs from our internal version to
this open version, so stay tuned!

NOTE: Google APIs wrapper requires Python 3.5 and above.

Installation

Installing this package from PyPy is simple, using pip:

pip install google-api-wrapper

You can add the --upgrade or -U flag to upgrade it if you already have it installed.

Building

Google APIs wrapper requires Python 3.5 and above. This is a hard requirement unfortunately. That aside, however,
building it is fairly simple - you just use pyvenv and pip install -e.

Now that we’ve created the distributions, we need to ensure we are able to upload our package to PyPi. To do this,
ensure you have an account over at PyPi as well as at
PyPi Testing. We will be using Twine to
perform the upload.

Ensure you’ve created the ~/.pypirc file, which should look like this (don’t forget to fill-in your credentials
inside it!):

Note that your own file might contain additional repositories - that’s ok. You will only be using pypitest and
pypi when working with this project though.

The project needs to be registered with PyPi (to reserve the package name).
Note that this only needs to be done once in the project’s lifetime, and has already been done for you!
You DO NOT need to run this. But for documentational purposes, here is the command to do it:

Now we can upload the package. We recommend first uploading it to the PyPi Testing
package index in order to verify it’s working properly. Here’s how:

twine upload --repository pypitest dist/*

Once you’re satisified with the results, you can upload it to the public repository, like this:

twine upload --repository pypi dist/*

Restore the version in setup.py to a dev version (eg. 1.1.0dev)

APIs

The package’s entry point to the APIs is the Cloud module. This module contains a single class - the Cloud
class, which you create an instance of using a Google Cloud JSON credentials file (usually generated from a service
account) and one or more scopes (scopes are essentially the list of permissions you are requesting to use). By default,
if you do not provide any scopes, the framework will ask for the https://www.googleapis.com/auth/cloud-platform
scope which means full permissions. Narrow it down to request more specific permissions instead.

Once you have an instance of the Cloud class, it can provide you with more specific Google Cloud API wrappers: