I'm trying to follow along with examples in the documentation cookbook, and looking at the 'Finding Public Content' script in particular: Finding Public Content – Posit Connect Documentation Version 2025.03.0
I'm getting an error that, as a non-Python programmer, is baffling:
(posit-sdk) jim@viz:~$ python posit-public-content.py
Traceback (most recent call last):
File "/home/jim/posit-sdk/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'owner'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jim/posit-public-content.py", line 11, in
content["Owner"] = (pd.json_normalize(content["owner"]))["username"]
~~~~~~~^^^^^^^^^
File "/home/jim/posit-sdk/lib/python3.12/site-packages/pandas/core/frame.py", line 4102, in getitem
indexer = self.columns.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jim/posit-sdk/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3812, in get_loc
raise KeyError(key) from err
KeyError: 'owner'
(posit-sdk) jim@viz:~$
Any ideas on what I've done wrong? Thanks!