на просторах интернета нашел бота который помогал мне в учебе выполняя некоторые задания на дистанционном обучении за меня.
Служил верой правой месяц .
С недавнего времени начал выдавать такую ошибку
Traceback (most recent call last): File "D:\python\as.py", line 31, in <module> f = r.json() File "D:\python\lib\site-packages\requests\models.py", line 808, in json return complexjson.loads(self.text, **kwargs) File "D:\python\lib\json\__init__.py", line 319, in loads return _default_decoder.decode(s) File "D:\python\lib\json\decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "D:\python\lib\json\decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
сам код прилагаю
# бот для выполнения упражнений # сайт: gramotei.cerm.ru import requests import json import collections #номер упражнения и куки rule_id = "1935085" cookie = "PHPSESSID=xxxxxxxxxxxxxxx" #заголовки пакетов headers = {"Host": "gramotei.cerm.ru", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0", "Accept": "*/*", "Accept-Language": "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3", "X-Requested-With": "XMLHttpRequest", "DNT": "1", "Referer": "http://gramotei.cerm.ru/student/train/"+rule_id, "Cookie": cookie, "Connection": "keep-alive"} headers2 = headers headers2["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8" y = 0 while y < 5: #получение заданий r = requests.post("http://gramotei.cerm.ru/student/train/"+rule_id+"/new", headers = headers) f = r.json() lol = [] n = 8 for lts in f["word"]: SaveDate = '{"id":'+json.dumps(lts["id"])+',"rule_id":'+json.dumps(lts["rule"])+',"status":"correct"}' lol.append(json.loads(SaveDate, object_pairs_hook=collections.OrderedDict)) if(n <= 0): data = "data="+json.dumps(lol) print(data) #отправка предварительного отчета чезез GET url = "http://gramotei.cerm.ru/App/Teacher/ajax.php?save_words=ok&ex_id="+rule_id+"&saving=0&data="+json.dumps(lol) SaveGet = requests.get(url, headers = headers) print(SaveGet.status_code, " ", SaveGet.text) #отправка отчета чезез POST SavePOST = requests.post("http://gramotei.cerm.ru/student/saveResult/"+rule_id, headers = headers2, data = data) print(SavePOST.status_code, " ", SavePOST.text) else: n=n-1