myint / language-check

Python wrapper for LanguageTool grammar checker
https://pypi.python.org/pypi/language-check
GNU Lesser General Public License v3.0
327 stars 101 forks source link

URLError temporary solution #81

Open mrzimu opened 2 years ago

mrzimu commented 2 years ago

Hi, I've fixed the URLError bug of language-check installation, which seems a temporary solution.

On line 19, add a function

    from urllib.request import urlopen, Request

On line 128, add headers

        headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}
        req = Request(url=url, headers=headers)
        with closing(urlopen(req)) as u:
"""
Reference: https://blog.csdn.net/eric_sunah/article/details/11301873
"""

Actually just add a header and the installatiion will be okay.

MCFreddie777 commented 2 years ago

Already done in https://github.com/myint/language-check/pull/79, just not merged yet.