Bolton-and-Menk-GIS / restapi

Python API designed to work externally with ArcGIS REST Services to query and extract data, and view service properties. Uses arcpy for some functions if available, otherwise uses open source alternatives to interact with the ArcGIS REST API. Also includes a subpackage for administering ArcGIS Server Sites.
GNU General Public License v2.0
93 stars 31 forks source link

Problem with username and password #11

Closed boesiii closed 6 years ago

boesiii commented 6 years ago

I am trying to access a certain AGOL layer but receive an error "Invalid username or password". I am using the code below. I got the URL from item details page on ArcGIS online.

url = 'https://services.arcgis.com/myorgID/arcgis/rest/services/my_layer_20180625/FeatureServer/0'
lyr = restapi.FeatureLayer(url,'my_username', 'my_password')

What am I doing wrong?

CalebM1987 commented 6 years ago

Looks like what you are doing is correct, however, I have noticed some strange quirks with AGOL and programmatic access. When you sign in with AGOL via your browser, the username is NOT case sensitive. But, when you access via Python and the REST API, the username is case sensitive.

Therefore, I would go into your AGOL account and make sure the username you are providing matches the case as it is set in the AGOL username. Also, to state the obvious, make sure the password you're using is also correct (this is always case sensitive).

boesiii commented 6 years ago

The username was mixed with some uppercase characters so that fixed it.