def _refresh_authentication_token(self):
        """
        POST to ArcGIS requesting a new token.
        """
        if self.retry == self._MAX_RETRIES:
            raise GeocoderAuthenticationFailure(
                'Too many retries for auth: %s' % self.retry
            )
        token_request_arguments = {
            'username': self.username,
            'password': self.password,
            'referer': self.referer,
            'expiration': self.token_lifetime,
            'f': 'json'
        }
        url = "?".join((self.auth_api, urlencode(token_request_arguments)))
        logger.debug(
            "%s._refresh_authentication_token: %s",
            self.__class__.__name__, url
        )
        self.token_expiry = int(time()) + self.token_lifetime
        response = self._base_call_geocoder(url)
        if 'token' not in response:
            raise GeocoderAuthenticationFailure(
                'Missing token in auth request.'
                'Request URL: %s; response JSON: %s' %
                (url, json.dumps(response))
            )
        self.retry = 0
        self.token = response['token']
def _refresh_authentication_token ( self ) : if self . retry == self . _MAX_RETRIES : raise GeocoderAuthenticationFailure ( 'Too many retries for auth: %s' % self . retry ) token_request_arguments = { 'username' : self . username , 'password' : self . password , 'referer' : self . referer , 'expiration' : self . token_lifetime , 'f' : 'json' } url = "?" . join ( ( self . auth_api , urlencode ( token_request_arguments ) ) ) logger . debug ( "%s._refresh_authentication_token: %s" , self . __class__ . __name__ , url ) self . token_expiry = int ( time ( ) ) + self . token_lifetime response = self . _base_call_geocoder ( url ) if 'token' not in response : raise GeocoderAuthenticationFailure ( 'Missing token in auth request.' 'Request URL: %s; response JSON: %s' % ( url , json . dumps ( response ) ) ) self . retry = 0 self . token = response [ 'token' ]
POST to ArcGIS requesting a new token.