Closed Yamazaki-Youichi closed 5 years ago
Hi @Yamazaki-Youichi, Thank you for your feedback!
If you want to list all these model informations. Use the method like this:
mdl = MDL()
results = mdl("", save_to=False)
The _
in python mean ignore some var but when use it a string that's not make sense.
for 1). Yes, as you said we need to publish our model list and also some additional informations as soon as possible. We wish that it can be done in next week.
for 2). I think the query string _
lead to this error because all modelsets' name contain character _
. This lead to a very long time querying and a huge size response body.
We are planning to add some simple query statements e.g listModeSets
, listProperties
and bring them to users in version 0.3.0.
@Yamazaki-Youichi, I have created a new issue #65 to collect the suggestion of high priority API.
Thank you for your reply and created new issue! I will wait for the new version. I'm sorry to trouble you.
Regarding to the JSONDecodeError raise issue,
in my opinion, the raising of JSONDecodeError to overwrite HTTPError is misleading.
For example, when server cause error by such bad query "_", it always needs to raise HTTPError.
However, in the present code, since JSONDecodeError is raised, there is no indication of bad queries.
I'm not good at coding but here is my suggestions:
def query(self, query, variables):
payload = json.dumps({'query': query, 'variables': variables})
ret = requests.post(url=self._url, headers=self._headers, data=payload)
if ret.status_code != 200:
# Here, When 504 error, ret.json() will raise error.
try:
message = ret.json()
except JSONDecodeError:
message = "Server does not return value."
raise HTTPError('status_code: %s, %s' %
(ret.status_code, message))
ret = ret.json()['data']
return ret
If it's not too much trouble, I will send pull request.
@Yamazaki-Youichi Yes, we should raise an HTTPError to give clear information to users. Thanks for your pr!
Thank you! I sent PR at https://github.com/yoshida-lab/XenonPy/pull/66
Close
Hello. Thank you for the awesome package. I have founded trivial things regarding the raise exception.
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I'm looking forward for your kind reply. Thank you very much.