0

I don't have really understanding of asp.net at all, but mechanize is doing weird things when I try to visit an aspx page: https://deerfield.hyatte-concierge.com/Welcome.aspx?langid=en-US I looked at this example: Screenscaping aspx with Python Mechanize - Javascript form submission

However, it seems like sometimes I get an error that says if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');

My code is very simple:

import mechanize
b = mechanize.Browser()
b.set_handle_robots(False)
response = b.open(new_url)
page = response.read()
print page

Sometimes I get the page sometimes I get an error, can somebody explain this to me?

Community
  • 1
  • 1
Dan
  • 2,647
  • 2
  • 27
  • 37
  • Have you tried reinstalling the AJAX extensions? – David Greydanus Jul 22 '14 at 02:21
  • I didn't realize those existed let me look into it really quick, thanks for the tip! – Dan Jul 22 '14 at 02:21
  • I just did a pip install of mechanize and I worked perfectly on the site you showed. – David Greydanus Jul 22 '14 at 02:24
  • Yeah sometimes it works for me and sometimes I get the error, that's what confuses me the most – Dan Jul 22 '14 at 02:30
  • What kind of scraping are you doing?Do you need mechanize, or could you just use urllib and bs4? – David Greydanus Jul 22 '14 at 02:32
  • I don't think urllib can read an aspx page? I've never used bs4 before, should I just give that a shot? All I need is to be able to read the page source on an .aspx page but I'm really having a lot of trouble – Dan Jul 22 '14 at 02:34
  • Maybe urllib would work on some pages but on this one it gives me this error: urllib2.HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop. – Dan Jul 22 '14 at 02:35

0 Answers0