mò mã¸Ec@s|dZdkZdkZdkZdklZdkZdkZdkZdei fd„ƒYZ defd„ƒYZ dS(s3Convenient HTTP UserAgent class. This is a subclass of urllib2.OpenerDirector. Copyright 2003-2006 John J. Lee This code is free software; you can redistribute it and/or modify it under the terms of the BSD or ZPL 2.1 licenses (see the file COPYING.txt included with the distribution). N(sOpenerDirectortHTTPRefererProcessorcBstZd„ZeZRS(NcCs0t|dƒo|ii|dtƒ}n|S(Nt redirect_dicttorigin_request(thasattrtrequesttselftparentt_add_referer_headertFalse(RR((t3/data/zmath/zope/lib/python/mechanize/_useragent.pyt http_requests(t__name__t __module__R t https_request(((R Rs t UserAgentc Bs‚tZdZhdei<dei<dei<dei<dei<dei <dei <dei <d ei <d ei <d ei<d ei<d ei<de<dei<dei<dei<dei<dei<dei<dei<dei<dei>> ua = UserAgent() >>> ua.addheaders = [ ... ("User-agent", "Mozilla/5.0 (compatible)"), ... ("From", "responsible.person@example.com")] thttptftptfiletgophert_unknownt _http_errort_http_request_upgradet_http_default_errort _basicautht _digestautht _redirectt_cookiest_refresht_referert_equivt_seekt_proxyt_proxy_basicautht_proxy_digestautht_robotst_gzipt_debug_redirectt_debug_response_bodyt HTTPSHandlerthttpscCs;ti|ƒh}|_x9|i|i|iD] }|i |}|ƒ||dD]6}|ii|ƒ}|dj o|i |ƒqqWdS(s!Print HTTP headers to sys.stdout.RR'N(RR'( tintReR^tlevelR/RR+tgetthR8tset_http_debuglevel(RR^RnRpR/((R tset_debug_http!s cCs{|djo|dj }n|o=|i|}|dj o||ƒ}qg|||Ž}nd}|i ||ƒdS(N( R^R8RORR0tnamet handler_classt newhandlertconstructor_argsRaRJ(RRsR^RORvRaRuRt((R RL)s   cCs‡|dj oK|ii|ƒ}|o.y|ii|ƒWqTtj oqTXqXn|dj o|i |ƒ||i|