Python
1---------------------------------------------------------------------------2JSONDecodeError Traceback (most recent call last)3File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\requests\models.py:971, in Response.json(self, **kwargs)4 970 try:5--> 971 return complexjson.loads(self.text, **kwargs)6 972 except JSONDecodeError as e:7 973 # Catch JSON-related errors and raise as requests.JSONDecodeError8 974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError9 10File D:\Anaconda_envs\envs\pip_env_2\lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)11 343 if (cls is None and object_hook is None and12 344 parse_int is None and parse_float is None and13 345 parse_constant is None and object_pairs_hook is None and not kw):14--> 346 return _default_decoder.decode(s)15 347 if cls is None:16 17File D:\Anaconda_envs\envs\pip_env_2\lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)18 333 """Return the Python representation of ``s`` (a ``str`` instance 19 334 containing a JSON document). 20 335 21 336 """22--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())23 338 end = _w(s, end).end()24 25File D:\Anaconda_envs\envs\pip_env_2\lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)26 354 except StopIteration as err:27--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None28 356 return obj, end 29 30JSONDecodeError: Expecting value: line 1 column 1 (char 0)31 32During handling of the above exception, another exception occurred:33 34JSONDecodeError Traceback (most recent call last)35Cell In[14], line 236 1 from easy_patents.get_info import app_progress 37----> 2 progress_info = app_progress("2020-18475", reget_date=0)38 39File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\easy_patents\get_info.py:586, in app_progress(case_number, law, reget_date)40 554 def app_progress(case_number, law="patent", reget_date=1):41 555 ''' 42 556 指定された特許出願番号に紐づく経過情報(優先権基礎情報、原出願情報、分割出願群情報を含まない)を取得する。 43 557 https://ip-data.jpo.go.jp/api_guide/api_reference.html#/%E7%89%B9%E8%A8%B1%E6%83%85%E5%A0%B1%E5%8F%96%E5%BE%97API/get-app_progress< 44 (...) 45 584 '特許庁' 46 585 '''47--> 586 return get_json(sys._getframe().f_code.co_name, case_number, law, reget_date)48 49File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\easy_patents\get_info.py:547, in get_json(api_type, key, law, reget_date, convert)50 545 else:51 546 url = make_url(api_type, key, law=law, convert=convert)52--> 547 json_data = get_api_info(url)53 549 # 次回以降の処理のために保存54 550 save_json(json_data, json_dir)55 56File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\easy_patents\get_info.py:44, in get_api_info(url)57 42 # 通信失敗などで取得エラーがありうるので、RETRY回までリトライする58 43 for i in range(0, EASYPATENT_API_RETRY):59---> 44 accesstoken = EASYPATENT_AUTHINFO.get_accesstoken()60 45 header = {61 46 "Host": EASYPATENT_HOST,62 47 "Authorization": "Bearer " + accesstoken, 63 48 "User-Agent": 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/4E423F'64 49 }65 50 response = requests.get(url, headers=header)66 67File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\easy_patents\auth_info.py:25, in AuthInfo.get_accesstoken(self)68 24 def get_accesstoken(self):69---> 25 self.refresh()70 26 return self.access_token 71 72File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\easy_patents\auth_info.py:39, in AuthInfo.refresh(self)73 37 now = datetime.now()74 38 if now > self.refresh_expires_in:75---> 39 self.get_token_by_username()76 40 elif now > self.expires_in:77 41 self.get_token_by_refresh_token()78 79File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\easy_patents\auth_info.py:62, in AuthInfo.get_token_by_username(self)80 60 now = datetime.now()81 61 response = get_token(self.username, self.password, self.token_path)82---> 62 self.update_tokens(now, response)83 84File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\easy_patents\auth_info.py:44, in AuthInfo.update_tokens(self, now, response)85 43 def update_tokens(self, now, response):86---> 44 response = response.json()87 45 # Configファイルのアップデート88 46 self.config['AuthInfo']['access_token'] = response['access_token']89 90File D:\Anaconda_envs\envs\pip_env_2\lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs)91 971 return complexjson.loads(self.text, **kwargs)92 972 except JSONDecodeError as e:93 973 # Catch JSON-related errors and raise as requests.JSONDecodeError94 974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError95--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)96 97JSONDecodeError: Expecting value: line 1 column 1 (char 0)98 99

0 コメント