So test() is going to have to grab the cookie and then include it with the
urlopen().
Seems kind of weird.
Well this has all been a good education to me about how cookies work.
I had not previously thought too hard about cookies, but just imagined
that somehow the website communicated with the browser behind the
scenes to get the cookie content when it needed it. From the responses
and a little
Thanks for your answers. I guess editing the html and replacing the
relative URLs with absolute ones is not too bad. The problem I am left
with is this:
Can one 'call' a URL from web2py as if the URL were called from the
users browser?, but capture the html result?
I imagine the answer to this
On Tuesday, December 13, 2011 4:15:22 AM UTC-5, peter wrote:
Thanks for your answers. I guess editing the html and replacing the
relative URLs with absolute ones is not too bad. The problem I am left
with is this:
Can one 'call' a URL from web2py as if the URL were called from the
users
Here is a simple example of what I mean:
If I type
http://127.0.0.1:8000/admin/default/site
at my browser when I am logged in, I get the installed applications
page.
However if I do it by calling the test routine below
def test():
import urllib
On Dec 13, 2011, at 11:09 AM, peter wrote:
Here is a simple example of what I mean:
If I type
http://127.0.0.1:8000/admin/default/site
at my browser when I am logged in, I get the installed applications
page.
However if I do it by calling the test routine below
def test():
On Tuesday, December 13, 2011 2:09:31 PM UTC-5, peter wrote:
def test():
import urllib
url=http://127.0.0.1:8000/admin/default/site;
f = urllib.urlopen(url)
s = f.read()
return s
I have to login again even though I am logged in on my computer. So
So in my example above. How does web2py's admin know I am logged in?
Does it do this by accessing a cookie on my computer, if so how does
it do that behind the scenes? Could urllib2.urlopen really handle
this?
Thanks
Peter
On Dec 13, 7:27 pm, Anthony abasta...@gmail.com wrote:
On Tuesday,
On Dec 13, 2011, at 12:28 PM, peter wrote:
So in my example above. How does web2py's admin know I am logged in?
Does it do this by accessing a cookie on my computer, if so how does
it do that behind the scenes? Could urllib2.urlopen really handle
this?
Ordinarily it knows you're logged in
On Tuesday, December 13, 2011 3:45:34 PM UTC-5, Jonathan Lundell wrote:
On Dec 13, 2011, at 12:28 PM, peter wrote:
So in my example above. How does web2py's admin know I am logged in?
Does it do this by accessing a cookie on my computer, if so how does
it do that behind the scenes? Could
On Dec 13, 2011, at 12:54 PM, Anthony wrote:
On Tuesday, December 13, 2011 3:45:34 PM UTC-5, Jonathan Lundell wrote:
On Dec 13, 2011, at 12:28 PM, peter wrote:
So in my example above. How does web2py's admin know I am logged in?
Does it do this by accessing a cookie on my computer, if so
I think it's easier than that, if you're already logged in, which I think
is the case here. The session cookie is already in request.cookies.
It sounded like he wanted to do this with external websites, not
necessarily the current app (or even a web2py app).
On Dec 13, 2011, at 1:40 PM, Anthony wrote:
I think it's easier than that, if you're already logged in, which I think is
the case here. The session cookie is already in request.cookies.
It sounded like he wanted to do this with external websites, not necessarily
the current app (or even a
Yeah, he's going to need to first script a login so he can grab and store
the cookie which he is then going to need to present on each
urllib.urlopen().
Being logged in on your browser is not going to help since your browser and
your web2py code are totally separate.
He could possibly make it
On Dec 13, 2011, at 5:22 PM, pbreit wrote:
Yeah, he's going to need to first script a login so he can grab and store the
cookie which he is then going to need to present on each urllib.urlopen().
Being logged in on your browser is not going to help since your browser and
your web2py code
Oh, I see. If the person logs in to a web2py app and then hits a page which
is going to do the urlopen that calls the same app, then I suppose you
could grab the cookie and send it along. Is that really what id being
contemplated?
I wonder if a LOAD() would suffice?
On Tuesday, December 13, 2011 8:36:47 PM UTC-5, pbreit wrote:
Oh, I see. If the person logs in to a web2py app and then hits a page
which is going to do the urlopen that calls the same app, then I suppose
you could grab the cookie and send it along. Is that really what id being
On Dec 13, 2011, at 6:20 PM, Anthony wrote:
The original example was for url of some web page, which I assume is not in
the same app (or necessarily even a web2py app at all). If it's in the same
app, or any web2py app under your control, there should be better ways to
return the output of
I guess that's not technically a redirect -- it's actually copying the
other page and delivering the copy. What do you mean it's no longer
connected to the session? The difficulty with copying a web page and
delivering the copy is that it might contain some relative URL references
(links as
You would have to rewrite the URLs to make them absolute (including URLs
within any static files linked in the page)
Correction -- you probably don't have to worry about relative URLs within
linked CSS files because they will be loaded relative to the CSS file URL
(so only that URL needs
Spend all week struggling with the same.
Basically you have to use browsers'
window.location.replace and initialize
the location via Python from your function.
Let say you are here:
http://www.mycoolapp.com/old_location
in the html you place the JavaScript
at the bottom before /body:
web2py redirect issues a standard http redirect, so the address will change
in the browser address bar. I believe you were using jQuery Mobile and
Ajax, which apparently introduces some complications (not specific to
web2py). For a regular application, a standard redirect should work fine.
In
yes, redirect is little tricky ;) my solution is for ajax.
23 matches
Mail list logo