you need to enclose that in a class like the examples you've been
reading,
and enclose that line, specifically on a get method. let's say for
example you named the class as "MainPage" in the above example , then
it must be mapped in "/" like
-------
from google.appengine.ext.webapp import Request
from google.appengine.ext import webapp
class MainPage(webapp.RequestHandler):
def get(self):
test = cgi.escape(self.request.get('test')
#eeewww, i'm using print :P
print test
application = webapp.WSGIApplication([('/',MainPage)], debug = True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
On Oct 27, 3:44 pm, fishfin <[EMAIL PROTECTED]> wrote:
> I've been reading through the documentation a little bit more
> carefully and decided to try this:
>
> from google.appengine.ext.webapp import Request
>
> test = Request.get(test)
>
> and I get an error message about how something is insufficient...
>
> On Oct 26, 7:01 pm, jeremy <[EMAIL PROTECTED]> wrote:
>
> > Are you calling those print statements in the same scope as
> > MainPage.get? If you could paste your entire handler script, that
> > might help us identify what's going wrong.
>
> > On Oct 26, 1:05 am, fishfin <[EMAIL PROTECTED]> wrote:
>
> > > Ok, I don't think I'm being very clear = )
>
> > > Say a user visits my website with this address
> > > bar:https://www.mywebsite.com/index.htm?data=123xyz
>
> > > I would like to place the '123xyz' into a variable so that I can
> > > access it whenever I want to. I think that loell's code does that
> > > except that I can't figure out how to get the value of 'data.'
>
> > > After using this: (and importing cgi and google.appengine.ext.webapp)
>
> > > class MainPage(webapp.RequestHandler):
> > > def get(self):
> > > data = cgi.escape(self.request.get('data'))
>
> > > I've tried:
> > > print data
> > > print MainPage.data
> > > print MainPage.self.data
> > > etc.
>
> > > I can't figure out how to access the '123xyz' from the url. I get the
> > > same error message every time: name 'data' is not defined
>
> > > On Oct 25, 4:35 pm, Hakayati <[EMAIL PROTECTED]> wrote:
>
> > > > You can retrieve URL parameters from the request object like this:
>
> > > > # e.g.www.mysite.com/?my_parameter=hello%20world
>
> > > > class MainPage(webapp.RequestHandler):
> > > > def get(self):
> > > > my_parameter = ''
> > > > for param in self.request.query.split('&'):
> > > > if param.startswith('my_parameter'):
> > > > my_parameter = param.split('=')[1]
>
> > > > On 25 Okt., 07:40, fishfin <[EMAIL PROTECTED]> wrote:
>
> > > > > I'm coming over from php and am trying to figure out how to do
> > > > > something.
>
> > > > > In php you can put data in the user's address bar (index.php?
> > > > > data=somedata) and then get it from the address bar really easily (you
> > > > > just use $_GET and $_REQUEST), so I was wondering what the equivalent
> > > > > is in python?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---