geopython / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
459 stars 250 forks source link

'API' object has no attribute 'get_collection_item' #1685

Closed nijiiffy closed 2 weeks ago

nijiiffy commented 2 weeks ago

Description I'm trying to integrate pyogcapi in a current django project, the docs are not so clear but i finally get it running. But when i try to get a item detail from a collections it thows an Exception:

AttributeError at /ogcapi/collections/lakes/items/0

'API' object has no attribute 'get_collection_item'
Request Method: | GET -- | -- http://localhost:8000/ogcapi/collections/lakes/items/0 5.0.6 AttributeError 'API' object has no attribute 'get_collection_item' C:\Users\Niji\PycharmProjects\Maptail\pygeoapi\django\views.py, line 572, in _feed_response pygeoapi.django.views.collection_item C:\Users\Niji\PycharmProjects\Maptail\venv\Scripts\python.exe 3.11.9 ['C:\\Users\\Niji\\PycharmProjects\\Maptail', 'C:\\Users\\Niji\\PycharmProjects\\Maptail', 'C:\\Program Files\\JetBrains\\PyCharm ' '2023.3.3\\plugins\\python\\helpers\\pycharm_display', 'C:\\Python311\\python311.zip', 'C:\\Python311\\DLLs', 'C:\\Python311\\Lib', 'C:\\Python311', 'C:\\Users\\Niji\\PycharmProjects\\Maptail\\venv', 'C:\\Users\\Niji\\PycharmProjects\\Maptail\\venv\\Lib\\site-packages', 'C:\\Program Files\\JetBrains\\PyCharm ' '2023.3.3\\plugins\\python\\helpers\\pycharm_matplotlib_backend']

Steps to Reproduce add pygeoapi master branch as a django app module, run all the stuff and try to explore de items in a collection

Expected behavior get the item details

Screenshots/Tracebacks imagen

imagen

Environment

Additional context looking at the last release (0.16.1) i see that get_collection_item is implemented as API method in api.py but i see now API lives in api/init.py but it misses a few methods, i notice that some belongs now to another files, but i'm not sure what happens with that get_collection_item

totycro commented 2 weeks ago

Thanks for reporting this and creating this detailed report!

The API class has been refactored and in fact split up. Apparently we missed this one occurrence here. i can't create a PR right, now but the fix should probably look like this here :

response_ = execute_from_django(itemtypes_api.get_collection_item, request,  collection_id, item_id)
tomkralidis commented 2 weeks ago

PR in #1686

cesarbenjamindotnet commented 2 weeks ago

excellent, thanks