A few weeks ago I posted regarding the basics of terminology and authentication for Google Maps Engine (GME) via the Python API. In this post we will cover the installation of the API, including verification of dependencies. This is one lesson that I learned the hard way, so hopefully I can make it a little easier on you.
To begin let's look at the API architecture and try to understand the core dependencies. This will help us out in debugging our installation and use. The PyDoc documentation of the API is a good place to start (http://google-api-python-client.googlecode.com/hg/docs/epy/frames.html
). As documented in the previous link, here are some of the dependencies to be aware of.
- Python 2.7 or higher is suggested
- pyOpenSSL is required
- Subdependencies include libcffi in order to be able to install Cryptography
- pyCrypto is required
Depending on your operating system there are different ways to install the API. For Linux and Mac, make sure you have a current installation of Setuptools
. Then execute the following;
easy_install --upgrade google-api-python-client
pip install --upgrade google-api-python-client
For Microsoft Windows;
- Download the API from here.
- Unzip the package to a location where you have rights
- Open a command prompt and navigate to the new directory
- Execute python setup.py install
To test your installation, open a Python prompt and execute the following;
from oauth2client.client import SignedJwtAssertionCredentials
If this returns an error, you most likely have a problem with your pyOpenSSL configuration. Go here
to start to debug problems with the pyOpenSSL installation.
Otherwise you have successfully installed the API and are now ready to proceed with setup your code.
In part 3, we will cover the actual code and the required elements to interface with GME.