I want to redirect a user to the next URL after authenticating on a third party web page. In the redirect URL I want it to contain some info about the user, i.e. session id. For example my redirect URL will be www.z.appspot.com/?session=x/
when the user returns to my page I want to parse some of their details from the new URL, for example www.z.appspot.com/?access_code=x/?token=y&user_id=u
but when trying to parse out the information it is unable to see the token in the URL as it takes it to be part of session. I tried using &
but still no joy
相关问题
- Views base64 encoded blob in HTML with PHP
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
Your question is a bit confusing, but is there a reason your other service can not redirect to:
www.z.appspot.com/?access_code=x/&token=y&user_id=u
? That should be correctly parsed:If you can not change the format of the url, you could do something like:
Or, if you're just trying to ask how to embed parameters in the URL they will be redirected to, see Python's urlencode.
Update:
Then pass
hunch_url
to your template.It looks like the service you're redirecting to doesn't compose query parameters in the continue URL correctly. The easiest way around this would be (as I suggested in your original question) to send the parameter as part of the path, rather than the query string - that is, use URLs of the form:
Where
1234
is the user's session ID or user ID.You want a module called cgi, and a function called FieldStorage. Do it like this:
You can do this for any of the URL parameters. Replace "default" with whatever you want the default value to be (like an empty string).