docs: def _initURL(self):
          """ sets proper URLs for AGOL """
  
          token = self._getTokenArcMap()
          if 'error' in token:
              self._valid = False
              self._message = token['error']
          else:
              self._valid = True
              self._message = "Token Generated"
          self._org_url = arcpy.GetActivePortalURL()
          if self._org_url.lower().find('/sharing/rest') > -1:
              self._url = self._org_url
          else:
              self._url = self._org_url + "/sharing/rest"
  
          if self._url.startswith('http://'):
              self._surl = self._url.replace('http://', 'https://')
          else:
              self._surl  =  self._url
  
          url = '{}/portals/self'.format( self._url)
  
          parameters = {
              'f': 'json'
          }
          portal_info = self._post(url=url,
                                   param_dict=parameters,
                                   securityHandler=self,
                                   proxy_port=self._proxy_port,
                                   proxy_url=self._proxy_url)
  
          if 'user' in portal_info:
              if 'username' in portal_info['user']:
                  self._username = portal_info['user']['username']
  
  
          results = self._get(url= self._surl + '/portals/info',
                                 param_dict={'f':'json'},
                                 proxy_port=self._proxy_port,
                                 proxy_url=self._proxy_url)
          if 'authInfo' in results and 'tokenServicesUrl' in results['authInfo']:
  
              self._token_url = results['authInfo']['tokenServicesUrl']
          else:
              self._token_url = self._surl  + '/generateToken'