Hello,
I been trying to access my ArcGIS online content using the API. So far I been able to access by Connecting through ArcGIS Pro but I would like to use my actual credentials to access the account.
I looked into the following method:
print("ArcGIS Online Org account") gis = GIS("NyCompanyURL", "MyUserName", "MyPassword")print("Logged in as " + str(gis.properties.user.username))
when I use this method, the scripts seems to be running but nothing happens. I am assuming I am using the wrong approach for an ArcGIS enterprise account. Any help is appreciated.
Your few lines of code work fine for me, and I tested with 2 different accounts. What if you try your code in an interactive Python session in a Command Prompt?
Joshua,
thank you for testing the code. IF I try the same code I get an error message about "Unable to generate token".
If I had to guess, your credentials are not working. Make sure to use Python raw strings (r"username") in case your username or password has any special characters that Python might be misinterpreting.
Joshua,
that is what I was thinking. I'm starting to think it has to do with my credentials. My password does have special characters because it is work policy. I will try the next suggestion see if that goes through. Thanks a lot.
What are you using for your company URL? For that GIS definition to work I had to do one of the following:
Michael,
I am using my enterprise company home page (https://CompanyName.maps.arcgis.com). I am using ArcGIS Pro to log in. That approach looks similar to your #1 approach. I will try # 3 see if that gives any results. Thank you