Hello everyone,
We get the following error message:
URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host>
when running the function below :
def generateToken():
print "Generating Token"
tokenURL = "https://arcgis.com/sharing/rest/generateToken"
data = {'username': PortalUtil.getAGOLUserName(),
'password': PortalUtil.getAGOLPassword(),
'referer': "https://www.arcgis.com",
'f': 'json'}
encodedData = urllib.urlencode(data)
tokenRequest = urllib2.Request(tokenURL, encodedData)
tokenResponse = urllib2.urlopen(tokenRequest)
tokenResponseJSON = json.load(tokenResponse)
print (tokenResponseJSON['token'])
return tokenResponseJSON['token']
token = generateToken()
Jose - were you able to find a resolution to this? We are having the same issue.
WE updated ArcGIS server from 10.4.x to 10.6.x and the issue was fixed. The new library in version 10.6 worked.