Reputation: 1020
Here is my main.py and I would like to extract everything after the equals sign.
The example url would be
/loggedin?frob=72157645687641769-37c9ec9b8fb35d48-125787757
and I would like to extract 72157645687641769-37c9ec9b8fb35d48-125787757
import webapp2
from flickr.views import Flickr, FlickrAuthorized
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write('Hello world!')
app = webapp2.WSGIApplication([
('/', MainHandler),
('/index', Flickr),
(r'/loggedin?frob=<:((?:[a-z][a-z]*[0-9]+[a-z0-9]*))>', FlickrAuthorized)
], debug=True)
My handler has the following class:
class FlickrAuthorized(webapp2.RequestHandler):
def get(self, frob):
print frob
//code
Upvotes: 0
Views: 141
Reputation: 10360
You should access the query-string parts from within your handler, not by matching them in the URL:
class FlickrAuthorized(webapp2.RequestHandler):
def get(self):
frob = self.request.get('frob')
# code...
app = webapp2.WSGIApplication([
('/', MainHandler),
('/index', Flickr),
(r'/loggedin', FlickrAuthorized)
], debug=True)
Upvotes: 5