Closed rob-yerc closed 3 years ago
Looks like small name change in a method.
I'm going to update the method to be search_amphora
It's going to have some extra parameters (org_id, skip, take), and return an object rather than an array directly.
I'll also include a sample
this will be fixed in 0.10.26
@rob-yerc this should be fixed in the latest pre-release. Can you try using it?
pip install amphoradata==0.10.26.dev1
The syntax has changed to ensure no strange breaking changes occur
results=client.search_amphora(term='Fridley Creek', labels='waterquality', take=5)
print(results.count)
print(f'There are {results.count} search results, and {len(results.items)} in items list')
if results.count > 0:
print(results.items[0])
Works great but did encounter this error if I didn't specify the 'take' parameter:
File "/.venv/lib64/python3.9/site-packages/amphora/client.py", line 158, in search_amphora return queryApi.search_search_amphora(term=term, labels=labels, org_id=org_id, lat = lat, lon = lon, dist = dist, skip=skip, take=take) File "/.venv/lib64/python3.9/site-packages/amphora_api_client/api/search_api.py", line 62, in search_search_amphora return self.search_search_amphora_with_http_info(** File "/.venv/lib64/python3.9/site-packages/amphora_api_client/api/search_api.py", line 113, in search_search_amphora_with_http_info if self.api_client.client_side_validation and 'take' in local_var_params and local_var_params[ TypeError: '>' not supported between instances of 'NoneType' and 'int'
One more thing. Would it be possible to add lat, long, and description to the results returned?
Good pickup on the missing take
parameter. I'll just set a sensible default of 64
take
problem is fixed in 0.10.26-dev2
One more thing. Would it be possible to add lat, long, and description to the results returned?
I'll open a different ticket for this. The API currently doesn't return those properties, so a to return them here would require a change to the server side.
@rob-yerc can you add in #22 why you'd like description returned?
Trying to execute the following code:
from amphora.client import AmphoraDataRepositoryClient, Credentials credentials = Credentials(username=,password=)
client = AmphoraDataRepositoryClient(credentials)
myamphora=client.search_for_amphorae(labels='rivernet')
I am getting the message 'Something went wrong, couldnt get the list of your Amphorae'
Part of the problem is that in SDK file amphora/client.py line 169: your_amphora_list.append(queryApi.search_search_amphorae(lat = lat, lon = lon, dist = dist))
the method name search_search_amphorae does not match the method name in the SearchApi class in amphora_api_client/api/search_api.py which is search_search_amphora(self, **kwargs):