AssertionError: Request global variable is not set

瘦欲@ 提交于 2019-12-11 18:38:20

问题


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.

来源:https://stackoverflow.com/questions/23044171/assertionerror-request-global-variable-is-not-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!