Do not spoof User-Agent: header - vt - Print definitions from Vocabolario Treccani
 (HTM) hg clone https://bitbucket.org/iamleot/vt
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) changeset 4fc9d09a80ee95782fa850729ee095a40afb5a3b
 (DIR) parent 9c76b8f6fd2c36921e3aef3522bc87b3b423dc34
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Fri, 22 Mar 2019 14:33:19 
       
       Do not spoof User-Agent: header
       
       Diffstat:
        vt.py |  6 ++----
        1 files changed, 2 insertions(+), 4 deletions(-)
       ---
       diff -r 9c76b8f6fd2c -r 4fc9d09a80ee vt.py
       --- a/vt.py     Sat Sep 29 20:32:32 2018 +0200
       +++ b/vt.py     Fri Mar 22 14:33:19 2019 +0100
       @@ -1,7 +1,7 @@
        #!/usr/pkg/bin/python3.7
        
        #
       -# Copyright (c) 2017 Leonardo Taccari
       +# Copyright (c) 2017-2019 Leonardo Taccari
        # All rights reserved.
        # 
        # Redistribution and use in source and binary forms, with or without
       @@ -55,9 +55,7 @@
            """
            url = 'http://www.treccani.it/vocabolario/' + parse.quote(term)
        
       -    req = request.Request(url)
       -    req.add_header('User-Agent', 'Mozilla/5.0')
       -    with request.urlopen(req) as r:
       +    with request.urlopen(url) as r:
                t = BeautifulSoup(r, 'html.parser',
                                  parse_only=SoupStrainer(class_='text spiega'))