Hello,
I use Arcgis online with Python. I used to connect like this:
from arcgis.gis import GIS
gis = GIS(username=XYZ, password=XYZ)
To connect to my Arcgis account, I now use OKTA, so I can no longer use the above method. I've tried using the portal url like this (non-interactive method):
gis = GIS(url=”https://XYZX.maps.arcgis.com”)
However, I have two problems:
- gis.users.me : this command returns null, so I can no longer use gis.users.me.items
- The following code generates a 'NoneType' object is not subscriptable error. The detailed error is shown below.
item_properties = {'title': XYZ, 'snippet': XYZ, 'tags': XYZ}
file = XYZ.csv
gis.content.add(item_properties, data = file, folder = XYZ)
Do you know how to connect properly with a non-interactive method and how to add files via this connection ? Thank you.
The detailed error :
/opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py in add(self, item_properties, data, thumbnail, metadata, owner, folder, item_id, **kwargs)
6835 if "text" in kwargs:
6836 item_properties["text"] = kwargs.pop("text", None)
-> 6837 itemid = self._portal.add_item(
6838 item_properties,
6839 data,
/opt/conda/lib/python3.9/site-packages/arcgis/gis/_impl/_portalpy.py in add_item(self, item_properties, data, thumbnail, metadata, owner, folder)
423 # If owner isn't specified, use the logged in user
424 if not owner:
--> 425 owner = self.logged_in_user()["username"]
426
427 # Setup the item path, including the folder, and post to it
TypeError: 'NoneType' object is not subscriptable