As written, this question is about the ArcGIS API for Python and not ArcGIS Enterprise or ArcGIS REST API. Question has been moved to ArcGIS API for Python.