You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get an error message containing the first 100 elements of my query. No exception is raised. No data is returned.
Expected result
There should be no error message. I should get the first 100 elements of my query. Ideally, I should also get the link to fetch the next batch of elements.
What happened?
Asset get_collection is using the _get method in service.py. This method supposes that a working query returns a 200 status code.
Unfortunately, Asset service limits the number of returned element to 100 by default. If the collection contains more elements, the status code returned is 206. Therefore, an error is logged and an exception is raised. But requests raises no exception for a 206 status code.
How to fix?
The condition in _get method could by changed for something like:
ifresponse:
# or ifresponse.ok:
It would then accept both 200 and 206 code. As a side effect, it would accept many more status code. Could this be annoying?
Nevertheless, this modification is not enough to address another problem: the link to the next data batch is lost. This link is present in the header of the response.
Work around
As a temporary work around, I just increased the number of elements that an Asset query can return. I added page_size=1000 as an argument of the Asset get_collection method.
Version
I use the 1.0.0rc1 version of PredixPy.
The text was updated successfully, but these errors were encountered:
Context
I have an Asset service containing a collection of 101 elements. I am using the
get_collection
method to get my elements.predixpy/predix/data/asset.py
Lines 86 to 87 in 61c7942
Result
I get an error message containing the first 100 elements of my query. No exception is raised. No data is returned.
Expected result
There should be no error message. I should get the first 100 elements of my query. Ideally, I should also get the link to fetch the next batch of elements.
What happened?
Asset
get_collection
is using the_get
method inservice.py
. This method supposes that a working query returns a 200 status code.predixpy/predix/service.py
Line 70 in 61c7942
Unfortunately, Asset service limits the number of returned element to 100 by default. If the collection contains more elements, the status code returned is 206. Therefore, an error is logged and an exception is raised. But
requests
raises no exception for a 206 status code.How to fix?
The condition in
_get
method could by changed for something like:It would then accept both 200 and 206 code. As a side effect, it would accept many more status code. Could this be annoying?
Nevertheless, this modification is not enough to address another problem: the link to the next data batch is lost. This link is present in the header of the response.
Work around
As a temporary work around, I just increased the number of elements that an Asset query can return. I added
page_size=1000
as an argument of the Assetget_collection
method.Version
I use the 1.0.0rc1 version of PredixPy.
The text was updated successfully, but these errors were encountered: