Skip to content

Commit 3be5f1a

Browse files
authored
Merge pull request #7 from mucwj/fix-parse-response-status
Fix the issue with parsing the incorrect return status
2 parents 78bd99d + 4d0db2b commit 3be5f1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jqdatapy/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def _get_token(mob=None, pwd=None):
318318
}
319319
response = requests.post(url, data=json.dumps(body))
320320

321-
if response.status_code != 200:
321+
if response.status_code != 200 or response.text.startswith("error"):
322322
print(f"request jqdata error,code:{response.status_code},text:{response.text}")
323323
raise HttpAccessError(code=response.status_code, msg=response.text)
324324

@@ -329,7 +329,7 @@ def _request_jqdata(method: string, token: string = jqdata_env["token"], **kwarg
329329
body = {"method": method, "token": token, **kwargs}
330330
response = jqdata_session.post(url, data=json.dumps(body))
331331

332-
if response.status_code != 200:
332+
if response.status_code != 200 or response.text.startswith("error"):
333333
print(f"request jqdata error,code:{response.status_code},text:{response.text}")
334334
raise HttpAccessError(code=response.status_code, msg=response.text)
335335

0 commit comments

Comments
 (0)