Hello,
I recently got a new work computer and I have a Juypter notebook that I have been using for some time and it's no longer working. My python code logs into our Portal so I can run other reports. I can log onto AGOL using this script, but not our Portal any more. Here is the code:
from arcgis.gis import GIS
from IPython.display import display
from getpass import getpass
import sys
import datetime
import time
ArcGISwebsite = input("Enter ArcGIS Portal / AGOL URL: ")
username = input("Enter user name: ")
password = getpass("Enter password: ")
g = GIS(ArcGISwebsite, username, password)
if g.properties.isPortal == True:
print("\nConnected to: {}\n\nConnected as: {}".format(g.properties.name + " (" + g.properties.portalHostname +")", g.users.me.username))
else:
print("\nConnected to: {}\n\nConnected as: {}".format(g.properties.name + " (" + g.properties.urlKey + "." + g.properties.customBaseUrl +")", g.users.me.username))
pass
I receive the "UnboundLocalError: local variable 'resp' referenced before assignment" at "g = GIS(ArcGISwebsite, username, password)". I'm running Windows 10 Pro, ArcGIS Pro 2.3.3, ArcMap 10.7. Any help would be greatly appreciated. Thanks!