Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9085323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:13:02+00:00 2026-06-16T21:13:02+00:00

I am trying to load a url and I get this error: DownloadError: ApplicationError:

  • 0

I am trying to load a url and I get this error:

DownloadError: ApplicationError: 2 Too many repeated redirects

This is the code I am using:

  headers = { 'User-Agent' : 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1' }    
  url = "http://www.cafebonappetit.com/menu/your-cafe/collins-cmc/cafes/details/50/collins-bistro"
  cmcHTM = urlfetch.fetch(url=url)
  cmcHTML = str(cmcHTM.content)

I check the redirections of this website at: http://www.internetofficer.com/seo-tool/redirect-check/
and I found that this site is redirected to itself! So url fetch seems to be going in circles trying to load this page.
Meanwhile, this page loads just fine in my browser.

So I tried using this code:

  cmcHTM = urlfetch.fetch(url=url,
    follow_redirects=False,
    deadline=100
    )

This just returns nothing though. Is there any way of getting this html?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:13:03+00:00Added an answer on June 16, 2026 at 9:13 pm

    Sorry for the delayed response. I found this that worked:

    import urllib, urllib2, Cookie
    from google.appengine.api import urlfetch
    
    class URLOpener:
      def __init__(self):
          self.cookie = Cookie.SimpleCookie()
    
      def open(self, url, data = None):
          if data is None:
              method = urlfetch.GET
          else:
              method = urlfetch.POST
    
          while url is not None:
              response = urlfetch.fetch(url=url,
                              payload=data,
                              method=method,
                              headers=self._getHeaders(self.cookie),
                              allow_truncated=False,
                              follow_redirects=False,
                              deadline=10
                              )
              data = None # Next request will be a get, so no need to send the data again. 
              method = urlfetch.GET
              self.cookie.load(response.headers.get('set-cookie', '')) # Load the cookies from the response
              url = response.headers.get('location')
    
          return response
    
      def _getHeaders(self, cookie):
          headers = {
                     'Host' : 'www.google.com',
                     'User-Agent' : 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)',
                     'Cookie' : self._makeCookieHeader(cookie)
                      }
          return headers
    
      def _makeCookieHeader(self, cookie):
          cookieHeader = ""
          for value in cookie.values():
              cookieHeader += "%s=%s; " % (value.key, value.value)
          return cookieHeader
    

    I guess the key is the while loop – following the redirects based on the return header…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to load and save setting with this code but when I closing
I'm trying to load a xml file located on wikipedia but I get this
I'm trying to load the url for a google calendar public calendar in a
I have an array of URL Links that I'm trying to load into a
i m trying load UIImages from server asynchronously in UITableViewCell. My code worked fine
Trying to load a small .txt file into mysql but get all my data
Trying to use this following script to load a page so that I can
I'm trying to make a call to a url in Django and load the
I'm trying to access a cross domain .js file using ajax: $.ajax({ type:'get', crossDomain:true,
i'm trying to make post to an external url using curl, the externa page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.