user3661956
user3661956

Reputation: 49

How to get URL into a variable to parse (python)

I'm not asking how do I parse a URL. I know that much.

What I'm asking is, let's say, on the client side, I put values into a URL and separate those values with an &.

How do I grab that URL in the first place before I even begin to parse it?

Here's some code (let's say the URL is http:// localhost:8888/CreateNewUser/username=george&password=corghi:

from datetime import date
import tornado.escape
import tornado.ioloop
import tornado.web
from urlparse import urlparse

class CreateNewUserHandler(tornado.web.RequestHandler):
    def get(self, username, password):
        arrayofvalues = urlparse('url') ***here's where I want the url to go but how do get it there? Each URL is unique so I can hard code it in***

        response = {
                  }
        self.write(response)

Upvotes: 0

Views: 514

Answers (1)

gilsho
gilsho

Reputation: 921

You can get current url inside RequestHandler using self.request.uri:

Upvotes: 2

Related Questions