Hi István,

If you know the cookies which need to be sent, you can construct HTTP
headers for each of the cookies and call the final URL and cut out the
redirects. To send a cookies as a header, you would add them to the
headers dictionary with something like this:

# A single cookie
# Cookie: name=value
headers['Cookie'] = '%s=%s' % (name, value)
# Multiple cookies, (note, they are all in one header)
# Cookie: name1=value1; name2=value2
cookies = {name1: value1, name2: value2}
headers['Cookie'] = '; '.join(['%s=%s' % (name, value) for name, value
in cookies.iteritems()])

Then include the headers in your urlfetch request (something like
this):

urlfetch.fetch(final_url, headers=headers)

Depending on the content of the name and value, you may need to escape
the strings.

Happy coding,

Jeff

On Nov 24, 12:41 am, István <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to fetch a wepage from my application, but it often
> results in a DeadlineExceededError. The reason for that is most likely
> that a lot of redirects happen in the background (unfortunately the
> webpage is such, and I cannot do anything about that).
>
> I was wondering about how to circumvent that. I could disable handling
> the redirects and read all replies and handle the redirects myself.
> However, the webpage sets several cookies, but I could not find a way
> to pass several cookies to urlfetch. Is there a way?
>
> Or can you recommend some other approach to tackle this problem?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to