0

I know this is a duplicate question but by referring previous answers i couldn't find the solution yet.

I am using Google report api to fetch logs. Please refer this link: https://developers.google.com/admin-sdk/reports/v1/libraries

Everything goes well and I am able to generate authorize URL using scope,client id etc. But I am not able to redirect user to URL to fetch "code" from authorize URL.

I tried using webapp2 script but throws error = AssertionError: Request global variable is not set.

Here is the code I am using for redirection:

import webapp2


class MainPage(webapp2.RequestHandler):

    def get(self):
        import ipdb;ipdb.set_trace()
        path='my authorize url path'
        return self.redirect(path) #throws error on this line


a1=MainPage() #object to call class

a2=a1.get() #call method of class

Where i am going wrong ? If webapp2 having standard bug for self.redirect, then which other framework can help to to perform same operation?

If i use app = webapp2.WSGIApplication([('/', MainPage)]) instead of creating objects then it doesnt even call get(self) function. Any help would be appreciated. Thanks.

User
  • 14,131
  • 2
  • 40
  • 59
shanky
  • 11
  • 2
  • Why on earth are you trying to call the get handler like that, and you can't just instantiate the handler like that, it needs to be initialised with a request. Have a look at the class definition of webapp2.RequestHandler – Tim Hoffman Apr 13 '14 at 15:29
  • app = webapp2.WSGIApplication([('/', MainPage)]) I tried this too. But as i mentioned in my post it doesnt call get(self) method. What exactly i need to do properly call webapp2 script. I doesnt know webaap2 programming. I am forced to use webapp2 to execute google api reports. ANy syntax or example would really help if you can provide. – shanky Apr 13 '14 at 15:57
  • The get method will be called when you access the URL mapped to the handler. WHat does your app.yaml look like ? – Tim Hoffman Apr 13 '14 at 23:21
  • How do I insert ipdb line it gives me error no module named ipdb. I already did pip install ipdb – Kishan Mehta Oct 26 '16 at 09:55

0 Answers0