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()