Tuesday, December 8, 2015

More details on Google App Engine os.environ attributes

We can use python
os
package in Google App Engine to obtain some useful information for the request. As mentioned, we can obtain user geolocation of a user. Actually, there is a lot more we can do with it.

A LIVE DEMO is available. The demo contains a full list of
os.environ
keys and their corresponding values. Some values are not publicly disclosed, but you can try it in your own application.

The values are accessed with
os.environ[key]
with
key
value available, such as
HTTP_USER_AGENT
and
REMOTE_ADDR
. However, some of the App Engine-specific keys such as
USER_EMAIL
and
HTTP_X_APPENGINE_COUNTRY
, only exist in the GAE environment.

The following section comes with the complete source code.


No comments:

Post a Comment