wodow
wodow

Reputation: 4345

How to programatically get the SDK version in Google Appengine (Python)?

The current version of the Google Appengine is 1.8.8.

It would be useful to be able to look this up at runtime, both on the development server and in production, to check that my application is running on the correct SDK (because it's not necessarily the most recent).

I've tried os.environ as per the Python runtime docs as well as the App Identity API but neither appear to expose "1.8.8" on the development server.

Upvotes: 1

Views: 402

Answers (2)

wodow
wodow

Reputation: 4345

It appears that there isn't a way of doing this consistently across the Appengine production platform and the development server.

So, to get the SDK version:

  • In production: use os.environ.
  • On the dev server: read the VERSION file in the GAE SDK directory (it's YAML format in version 1.8.8).

Upvotes: 1

Velimir Mlaker
Velimir Mlaker

Reputation: 10955

The value of

os.environ['SERVER_SOFTWARE']

is a string like

Google App Engine/1.8.8

or on development it's something like

Development/2.0

So you can just parse out the version number yourself, for example:

soft = os.environ['SERVER_SOFTWARE']
ver = soft[soft.find('/')+1:]  # Either '1.8.8' or '2.0' depending on version.

Upvotes: 3

Related Questions