Get id of consumption profile.
499079
def _get_p_p_id_and_contract(self):
        """"""
        contracts = {}
        try:
            raw_res = yield from self._session.get(PROFILE_URL,
                                                   timeout=self._timeout)
        except OSError:
            raise PyHydroQuebecError("Can not get profile page")
        # Parse html
        content = yield from raw_res.text()
        soup = BeautifulSoup(content, 'html.parser')
        # Search contracts
        for node in soup.find_all('span', {"class": "contrat"}):
            rematch = re.match("C[a-z]* ([0-9]{4} [0-9]{5})", node.text)
            if rematch is not None:
                contracts[rematch.group(1).replace(" ", "")] = None
        # search for links
        for node in soup.find_all('a', {"class": "big iconLink"}):
            for contract in contracts:
                if contract in node.attrs.get('href'):
                    contracts[contract] = node.attrs.get('href')
        # Looking for p_p_id
        p_p_id = None
        for node in soup.find_all('span'):
            node_id = node.attrs.get('id', "")
            if node_id.startswith("p_portraitConsommation_WAR"):
                p_p_id = node_id[2:]
                break

        if p_p_id is None:
            raise PyHydroQuebecError("Could not get p_p_id")

        return p_p_id, contracts
1290581
def ConsumeIdentifier(self):
    
    result = self.token
    if not self._IDENTIFIER.match(result):
      raise self.ParseError('Expected identifier.')
    self.NextToken()
    return result
1353270
def info(cls, resource):
        """"""
        snps = cls.list({'id': cls.usable_id(resource)})
        if len(snps) == 1:
            return snps[0]
        elif not snps:
            return

        raise DuplicateResults('snapshot profile %s is ambiguous.' % resource)
890938
def correspondent_id(self):
        
        try:
            return int(self._thread_element.attrib['data-personid'])
        except (ValueError, KeyError):
            try:
                return int(self.correspondent_profile.id)
            except:
                pass
550931
def get_power(self):
        """"""
        self.get_status()
        try:
            self.consumption = self.data['power']
        except TypeError:
            self.consumption = 0

        return self.consumption
1013207
def get_device_id(self, use_cached=True):
        """"""
        device_json = self.get_device_json(use_cached)
        return device_json["id"].get("devId")
781132
def load_profile(self, profile_name):
        """"""
        data = self.storage.get_user_profiles(profile_name)

        for x in data.get_user_views():
            self._graph.add_edge(int(x[0]), int(x[1]), {'weight': float(x[2])})
            self.all_records[int(x[1])] += 1

        return self._graph
1021380
def getProfile(self, profile=None):
    '''
    
    '''
    if profile is None:
      # todo: what if the configuration `profile.default` does not exist?
      profile = self.config.get('DEFAULT', 'profile.default')
    if profile in self.profiles:
      return self.profiles[profile].init()
    for prof in self.profiles.values():
      if prof.name == profile:
        return prof.init()
    for prof in self.profiles.values():
      if prof.name.lower() == profile.lower():
        return prof.init()
    raise KeyError(profile)
262584
def associate_flavor(self, flavor, body):
        """"""
        return self.post(self.flavor_profile_bindings_path %
                         (flavor), body=body)
12389
def get_profile_data(self, raw_token):
        """"""
        token_data = json.loads(raw_token)
        # This header is the 'magic' that makes this empty GET request work.
        headers = {'Authorization': 'OAuth %s' % token_data['access_token']}

        try:
            response = self.request('get', self.profile_url, headers=headers)
            response.raise_for_status()
        except RequestException as e:
            logger.error('Unable to fetch user profile: {0}'.format(e))
            return None
        else:
            return response.json() or response.text
1064976
def identifier(self):
        """"""
        ident = self._json['coredata']['dc:identifier'].split(":")[-1]
        if ident != self._id:
            text = "Profile with ID {} has been merged and the new ID is "\
                   "{}.  Please update your records manually.  Files have "\
                   "been cached with the old ID.".format(self._id, ident)
            warn(text, UserWarning)
        return ident
845076
public String getNamefromId(int id) {
        return (String) sqlService.getFromTable(
            Constants.PROFILE_PROFILE_NAME, Constants.GENERIC_ID,
            id, Constants.DB_TABLE_PROFILE);
    }
247374
def _get_profile(self):
        
        url = PROFILE_URL + self.hash + '.json'
        try:
            profile = json.load(urlopen(url))
            # set the profile as an instance variable
            self._profile = profile['entry'][0]
        except:
            self._profile = {}
1062460
def profile_path(profile_id, profile):
    """"""
    user = os.path.expanduser("~")
    return os.path.join(user, profile_id + profile)
929673
def ManagedPreferenceProfile(self, data=None, subset=None):
        """"""
        return self.factory.get_object(jssobjects.ManagedPreferenceProfile,
                                       data, subset)
816595
def vanity(self):
        
        purl = self.profile_url.strip('/')
        if purl.find("/id/") != -1:
            return os.path.basename(purl)
927359
def _CaptureUserId(self):
    """"""
    user_kind, user_id = user_id_collector()
    if user_kind and user_id:
      self.breakpoint['evaluatedUserId'] = {'kind': user_kind, 'id': user_id}