Esri / ArcREST

python package for REST API (AGS, AGOL, webmap JSON, etc..)
Apache License 2.0
192 stars 155 forks source link

ArcRest "arcrest.agol.services.FeatureService.createReplica" works on one ArcGIS Online organization but not another #356

Open asmyrk opened 7 years ago

asmyrk commented 7 years ago

ArcRest

I'm using the same exact script to create a replica and download a file geodatabase. All works well on one organization, but as soon as I modify to hit a different organization, it fails with the following error.

Runtime error Traceback (most recent call last): File "", line 24, in File "C:\Python27\ArcGIS10.5\lib\site-packages\arcrest\security\security.py", line 1173, in init urlInfo=urlInfo._replace(netloc= "%s.%s" % (portalSelf.urlKey, portalSelf.customBaseUrl)) File "C:\Python27\ArcGIS10.5\lib\site-packages\arcrest\manageorg_portals.py", line 331, in urlKey self.init() File "C:\Python27\ArcGIS10.5\lib\site-packages\arcrest\manageorg_portals.py", line 235, in init proxy_url=self._proxy_url) File "C:\Python27\ArcGIS10.5\lib\site-packages\arcrest\web_base.py", line 686, in _get context=ctx) File "C:\Python27\ArcGIS10.5\Lib\urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "C:\Python27\ArcGIS10.5\Lib\urllib2.py", line 429, in open response = self._open(req, data) File "C:\Python27\ArcGIS10.5\Lib\urllib2.py", line 447, in _open '_open', req) File "C:\Python27\ArcGIS10.5\Lib\urllib2.py", line 407, in _call_chain result = func(*args) File "C:\Python27\ArcGIS10.5\Lib\urllib2.py", line 1241, in https_open context=self._context) File "C:\Python27\ArcGIS10.5\Lib\urllib2.py", line 1198, in do_open raise URLError(err) URLError: <urlopen error [Errno 11001] getaddrinfo failed>

I can't figure out what's different between these organizations. All settings look the same. I can create replicas manually from these feature services. Is there an ArcGIS Online setting that would cause this issue?

MikeMillerGIS commented 7 years ago

Bet it requires https. Ensure the url to your org is https://www.arcgis.com

Sent from my Verizon Wireless 4G LTE DROID

asmyrk commented 7 years ago

Thanks for the response Mike. I appreciate it very much. Neither organization's url is https, so I didn't try that before, but I did try now just in case, but I get the same error. On feature services... same thing. I've tried them with http and https, but the error message does not change.

MikeMillerGIS commented 7 years ago

Did you ensure the org URL is https, not just the feature service.

asmyrk commented 7 years ago

I believe so, but the only way I know to do that is to check the box to only allow https communication, and then it changes the url of the organization from http to https?

From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, August 23, 2017 2:31 PM To: Esri/ArcREST ArcREST@noreply.github.com Cc: Alison Walker alison@frontierprecision.com; Author author@noreply.github.com Subject: Re: [Esri/ArcREST] ArcRest "arcrest.agol.services.FeatureService.createReplica" works on one ArcGIS Online organization but not another (#356)

Did you ensure the org URL is https, not just the feature service.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Esri/ArcREST/issues/356#issuecomment-324453629, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ad1pGztbbvUI2YWOQjXcDOgegyoNFaR6ks5sbIwTgaJpZM4PAV-P.

MikeMillerGIS commented 7 years ago

Could you post your script?

asmyrk commented 7 years ago

Does this work? AGOLpics - Copy.zip

MikeMillerGIS commented 7 years ago

Think you need to pass in the agolsecurityhandler the org url as https.

Sent from my Verizon Wireless 4G LTE DROID

asmyrk commented 7 years ago

Thank you Michael. I’m going to try that.

… pardon my ignorance, do you have a sample of what that might look like?

From: Michael Miller [mailto:notifications@github.com] Sent: Wednesday, August 23, 2017 6:51 PM To: Esri/ArcREST ArcREST@noreply.github.com Cc: Alison Walker alison@frontierprecision.com; Author author@noreply.github.com Subject: Re: [Esri/ArcREST] ArcRest "arcrest.agol.services.FeatureService.createReplica" works on one ArcGIS Online organization but not another (#356)

Think you need to pass in the agolsecurityhandler the org url as https.

Sent from my Verizon Wireless 4G LTE DROID

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Esri/ArcREST/issues/356#issuecomment-324501573, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ad1pG2vR--EW3-pGzVQtAKYExog5HCaJks5sbMjXgaJpZM4PAV-P.

MikeMillerGIS commented 7 years ago

Here is the line - https://github.com/Esri/ArcREST/blob/master/src/arcrest/security/security.py#L1112

but looking at it, it is defaulting to https. So my next guess is the user name and password is wrong. ArcRest is case sensitive for both the username and password. Log into the organization with a browser and verify the username. That produces this error. This has caught a number of people.

I would also install fiddler and monitor the calls, looking at the response can help you figure out what is going on.

asmyrk commented 7 years ago

Wow, I’m such an idiot, and a little embarrassed. You are absolutely right. I had one letter lowercase when it needed to be capitalized, and voila! Fixed. But thank you so much for taking the time to take a look and point me in the right direction. I probably would never have given it a second look.

From: Michael Miller [mailto:notifications@github.com] Sent: Thursday, August 24, 2017 12:03 PM To: Esri/ArcREST ArcREST@noreply.github.com Cc: Alison Walker alison@frontierprecision.com; Author author@noreply.github.com Subject: Re: [Esri/ArcREST] ArcRest "arcrest.agol.services.FeatureService.createReplica" works on one ArcGIS Online organization but not another (#356)

Here is the line - https://github.com/Esri/ArcREST/blob/master/src/arcrest/security/security.py#L1112

but looking at it, it is defaulting to https. So my next guess is the user name and password is wrong. ArcRest is case sensitive for both the username and password. Log into the organization with a browser and verify the username. That produces this error. This has caught a number of people.

I would also install fiddler and monitor the calls, looking at the response can help you figure out what is going on.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Esri/ArcREST/issues/356#issuecomment-324711703, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ad1pG0qIooUaq-wCttYZrWuEMERSD6Tqks5sbbrigaJpZM4PAV-P.