@property
    def _contents(self):
        try:
            return super(GenerateToken, self)._contents
        except compat.urllib2.HTTPError:
            if self._html_login:
                # Hack: scrape HTML version for path to /login,
                ##      then to wherever generateToken lives
                username, password = self._username, self._password
                payload ={'username': username,
                          'password': password,
                          'redirect': '/'}
                # Loop through what look like forms
                for formurl in re.findall('action="(.*?)"',
                                          compat.urllib2.urlopen(self._referer)
                                                                      .read()):
                    relurl = compat.urljoin(self._referer, formurl)
                    try:
                        html_request = compat.urllib2.Request(relurl,
                                                       compat.urlencode(
                                                                    payload),
                                                      {'Referer': 
                                                          self._referer})
                        html_response = compat.urllib2.urlopen(html_request).read()

                        # Seek out what looks like the redirect hidden form
                        # element in the HTML response
                        redirect_value = [re.findall('value="(.*?)"', input) 
                                          for input in 
                                            re.findall(
                                                '<input.*?name="redirect".*?>',
                                                html_response)]
                        if redirect_value:
                            redirect = redirect_value[0][0]
                        else:
                            redirect = None
                        # Loop through what look like links
                        for href in re.findall('(?:href|action)="(.*?)"',
                                               html_response):
                            if href.lower() in 'generatetoken':
                                try:
                                    gentokenurl = compat.urljoin(relurl,
                                                                   href)
                                    gentokenpayload = {'username': username,
                                                       'password': password,
                                                       'expiration': 
                                                            str(
                                                             self._expiration),
                                                       'client': 'requestip',
                                                       'f': 'json'}
                                    if redirect:
                                        gentokenpayload['redirect'] = redirect
                                    self.__urldata__ = compat.urlopen(
                                                          gentokenurl,
                                                          compat.urlencode(
                                                               gentokenpayload)
                                                          ).read()
                                    if self.__urldata__:
                                        return self.__urldata__
                                except compat.HTTPError:
                                    pass
                    except compat.urllib2.HTTPError:
                        pass
                return self.__urldata__ or '{}'
            else:
                raise

# On top of a URL, the ArcGIS Server folder structure lists subfolders
# and services.
dataset/ETHPy150Open jasonbot/arcrest/arcrest/server.py/GenerateToken._contents/swapped operands of `in`