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
The APIKeyManager.get() method and keys property don't correctly retrieve existing API keys, despite documentation suggesting these should return valid API keys. The API keys exist and can be found through content search, but the dedicated API key retrieval methods return None or empty lists.
To Reproduce
Steps to reproduce the behavior:
importarcgisfromarcgis.gisimportGIS# Connect to ArcGIS Onlinegis=GIS("https://www.arcgis.com", "username", "password")
# First search for API keys to confirm they existapi_keys=gis.content.search(query="", item_type="Application",
max_items=10,
outside_org=False)
api_key= [kforkinapi_keysif"APIToken"ink.typeKeywords][0]
print(f"API Key found via content search: {api_key.title} (ID: {api_key.id})")
# Try to retrieve the same API key using documented methodsprint("\nAttempting API Key retrieval using get() method")
key_by_title=gis.api_keys.get(title=api_key.title)
print(f"Result: {key_by_title}") # Returns None# Try using APIKeyManager directlyprint("\nAttempting retrieval via APIKeyManager")
api_key_manager=arcgis.gis._impl.APIKeyManager(gis)
keys_list=api_key_manager.keysprint(f"API keys found: {len(keys_list)}") # Returns 0 even when keys exist
Expected behavior
The get() method should return an API key when given a valid title, and the keys property should return a list of all available API keys for the authenticated user.
Workaround
The only working approach is to manually instantiate an APIKey class with an item found through content search:
# Workaround: create API key class directlyfromarcgis.gis._implimportAPIKeyapi_key_class=APIKey(api_key, gis)
print(f"Successfully created API Key class via workaround: {api_key_class}")
Describe the bug
The
APIKeyManager.get()
method andkeys
property don't correctly retrieve existing API keys, despite documentation suggesting these should return valid API keys. The API keys exist and can be found through content search, but the dedicated API key retrieval methods returnNone
or empty lists.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The
get()
method should return an API key when given a valid title, and thekeys
property should return a list of all available API keys for the authenticated user.Workaround
The only working approach is to manually instantiate an
APIKey
class with an item found through content search:Platform
Additional context
The official documentation at https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#apikeymanager suggests these methods should work as expected, but they don't seem to function correctly in version 2.4.0.
The text was updated successfully, but these errors were encountered: