Using the ArcGIS API for Python, when I create my GIS object:

gis = GIS(config["agol"]["agol_gis_url"], config["agol"]["agol_gis_user"], config["agol"]["agol_gis_pass"])

I can verify that it connects by checking if I have a token:

token = gis._con.token

But If I try to create a FeatureLayer and search, I get an authentication error (499):

p = FeatureLayer(config["agol"]["resource_locs_fs_url"])
result = gis.content.search("id:{0}".format(p.properties.serviceItemId))

Error running result = gis.content.search("id:{0}".format(p.properties.serviceItemId)) in 'C:\test\main.py'. Message: (Error Code: 499)

If I go into ArcGIS Online and share the item to Everyone, the code works fine. However, the item needs to be secured, so that is not an option. Shouldn't my gis object grant me access to the item?

  • 1
    I just ran into this with my internal Portal - beating my head against my desk. Came upon this question which made me realize that neither my feature layer nor the map image layer was shared. D'OH! Make sure your item is shared, people. Commented Mar 26, 2019 at 21:52

1 Answer 1


The item was not shared as previously assumed. Once sharing properties were updated, the item was in the search results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.