@@ -89,7 +89,6 @@ COLORMAP = {k: '\x1b[%sm' % v for k, v in {
8989}.items ()}
9090
9191USER_AGENT = 'googler/%s (like MSIE)' % _VERSION_
92- ua = True # User Agent is enabled by default
9392
9493text_browsers = ['elinks' , 'links' , 'lynx' , 'w3m' , 'www-browser' ]
9594
@@ -2067,7 +2066,7 @@ class GoogleConnection(object):
20672066 self ._conn .request ('GET' , url , None , {
20682067 'Accept' : 'text/html' ,
20692068 'Accept-Encoding' : 'gzip' ,
2070- 'User-Agent' : USER_AGENT if ua else '' ,
2069+ 'User-Agent' : USER_AGENT ,
20712070 'Cookie' : self .cookie ,
20722071 'Connection' : 'keep-alive' ,
20732072 'DNT' : '1' ,
@@ -3183,7 +3182,7 @@ def parse_args(args=None, namespace=None):
31833182 addarg ('-p' , '--proxy' , default = https_proxy_from_environment (),
31843183 help = """tunnel traffic through an HTTP proxy;
31853184 PROXY is of the form [http://][user:password@]proxyhost[:port]""" )
3186- addarg ('--noua' , action = 'store_true' , help = 'disable user agent ' )
3185+ addarg ('--noua' , action = 'store_true' , help = 'legacy option (no effect) ' )
31873186 addarg ('--notweak' , action = 'store_true' ,
31883187 help = 'disable TCP optimizations and forced TLS 1.2' )
31893188 addarg ('--json' , action = 'store_true' ,
@@ -3214,8 +3213,6 @@ def parse_args(args=None, namespace=None):
32143213
32153214
32163215def main ():
3217- global ua
3218-
32193216 try :
32203217 opts = parse_args ()
32213218
@@ -3280,8 +3277,7 @@ def main():
32803277 open_url .suppress_browser_output = True
32813278
32823279 if opts .noua :
3283- logger .debug ('User Agent is disabled' )
3284- ua = False
3280+ logger .warning ('--noua option has been deprecated and has no effect (see #284)' )
32853281
32863282 repl = GooglerCmd (opts )
32873283
0 commit comments