views:

143

answers:

3

Hi,

does someone have an idea how to get the environment variables on Google-AppEngine ?

I'm trying to write a simple Script that shall use the Client-IP (for Authentication) and a parameter (geturl or so) from the URL (for e.g. http://thingy.appspot.dom/index?geturl=www.google.at)

I red that i should be able to get the Client-IP via "request.remote_addr" but i seem to lack 'request' even tho i imported webapp from google.appengine.ext

Many thanks in advance, Birt

+1  A: 

Are you using webapp or doing CGI-style? The webapp request class is documented at the appengine docs.

ironfroggy
+2  A: 

In short, assuming you're using webapp: you can get the client ip address via self.request.remote_addr and the parameter with self.request.get("geturl")

See the Handling Forms with webapp section of the tutorial.

ema
+2  A: 

To answer the actual question from the title of your post, assuming you're still wondering: to get environment variables, simple import os and the environment is available in os.environ.

Wooble