We're having the following situation: We need to access a site which need to be accessed only with MSIE.
For this reason, we must change the spynner User Agent, because this is not MSIE by default.
Here is my code:
import re
import spynner
from pyquery import PyQuery
import time
import sys
tipo_navegador = "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))"
br = spynner.Browser(
ignore_ssl_errors=True,
user_agent=tipo_navegador,
debug_level=spynner.WARNING,
debug_stream=sys.stderr)
br.create_webview()
br.show()
br.set_html_parser(PyQuery)
br.load("https://myurl.com/index.php")
br.browse()
br.close()
Debugging Spynner we saw the modified User Agent:
Page load started
Request: GET https://myurl.com/index.php
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))
From Web site we receive the default User Agent:
Mozilla/5.0 (Windows NT 6.0; rv:43.0) Gecko/20100101 Firefox/43.0