Python, mechanize, proper syntax for setting multiple headers?

喜你入骨 提交于 2019-11-29 07:02:35
Seth Difley

According to http://wwwsearch.sourceforge.net/mechanize/doc.html#adding-headers, the syntax would be

br.addheaders = [('user-agent', '   Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3'),
('accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')]

That is, make a list of header tuples.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!