'Gingerit Grammar Correction throwing error

I was using gingerit for grammar correction, earlier code was working fine as expected.

But suddenly started getting below error

  File "<ipython-input-28-6cd092a93112>", line 6, in <module>
    parser.parse(text)

  File "C:\ProgramData\Anaconda3\lib\site-packages\gingerit\gingerit.py", line 27, in parse
    data = request.json()

  File "C:\Users\AppData\Roaming\Python\Python38\site-packages\requests\models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)

  File "C:\ProgramData\Anaconda3\lib\site-packages\simplejson\__init__.py", line 525, in loads
    return _default_decoder.decode(s)

  File "C:\ProgramData\Anaconda3\lib\site-packages\simplejson\decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)

  File "C:\ProgramData\Anaconda3\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value

Below code was working fine

from gingerit.gingerit import GingerIt

text = 'The smelt of fliwers bring back memories.'

parser = GingerIt()
parser.parse(text)

Can anyone help me in this.



Solution 1:[1]

Had the same issue and fixed it with the following solution provided by MythicalMAxX on https://github.com/Azd325/gingerit/issues/24

"It was cloudflare antibot which was blocking request. So you all can fix it by importing cloudscraper and replacing line 16 session = requests.Session() TO session = cloudscraper.create_scraper() In gingerit.py"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RudeFerret