Esri / ArcREST

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

Problem creating AGOL token #192

Closed ngoorman closed 8 years ago

ngoorman commented 8 years ago

Hi,

this is the same script as my colleague posted about in issue #191 - thanks for the quick response on that :) However, I installed the latest version and I now get the following error:

Traceback (most recent call last): File "", line 12, in File "C:\Python27\ArcGIS10.2\lib\site-packages\arcrest\security\security.py", line 1167, in init self._initURL(org_url=org_url,token_url=token_url) File "C:\Python27\ArcGIS10.2\lib\site-packages\arcrest\security\security.py", line 1195, in _initURL proxy_url=self._proxy_url) File "C:\Python27\ArcGIS10.2\lib\site-packages\arcrest\web_base.py", line 608, in _get resp = request.urlopen(req) File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 127, in urlopen return _opener.open(url, data, timeout) File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 404, in open response = self._open(req, data) File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 422, in _open '_open', req) File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 382, in _call_chain result = func(*args) File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 1222, in https_open return self.do_open(httplib.HTTPSConnection, req) File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 1181, in do_open h.request(req.get_method(), req.get_selector(), req.data, headers) File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 973, in request self._send_request(method, url, body, headers) File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 1007, in _send_request self.endheaders(body) File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 969, in endheaders self._send_output(message_body) File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 833, in _send_output self.send(message_body) File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 805, in send self.sock.sendall(data) File "C:\Python27\ArcGIS10.2\lib\ssl.py", line 229, in sendall v = self.send(data[count:]) TypeError: unhashable type

I took everything out of my code until I was left with the following: _ import arcrest

PARAMETERS

username = password = LayerUrl = "http://services1.arcgis.com/lw8Ufgjf3JEnBWrW/ArcGIS/rest/services/Fietsen/FeatureServer/0" org_url = "https://heijmansnl.maps.arcgis.com"

PARAMETERS

genereer token

AGOtoken = arcrest.security.AGOLTokenSecurityHandler(username, password, orgurl)

I also tried without the org_url, no difference. Any advice would be appreciated.

achapkowski commented 8 years ago

try this: arcrest.AGOLTokenSecurityHandler(username,password).

Verify the username/password as well. Does your user have access to that service?

I cannot reproduce your issue.

ngoorman commented 8 years ago

Thanks for the response. The change makes no difference, and the username/password I'm using are correct; I can login to AGO with them through the browser.

What would I need to do to reinstall ArcRest? I want to make sure no files of the older versions are left behind and do a clean install.

achapkowski commented 8 years ago

It's an issue with Python 2.7.5 specifically. We are looking into it.

ngoorman commented 8 years ago

That's indeed the version we're using, came bundled with ArcGIS 10.2. Thanks for your help.

MikeMillerGIS commented 8 years ago

@ngoorman I made a fix to the get function that should resolved the issue. Tested on 10.2.1 and 10.4

ngoorman commented 8 years ago

Yes, this fixed the problem for me with Python 2.7.5 and ArcGIS 10.2.2, and my colleague with 10.3. Thanks for the fast response!