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 google-appengine@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---