def get_services(self):
        """
        get_services makes call to services end point of api.embed.ly to fetch
        the list of supported providers and their regexes
        """

        if self.services:
            return self.services

        url = 'http://api.embed.ly/1/services/python'

        http = httplib2.Http(timeout=self.timeout)
        headers = {'User-Agent': self.user_agent,
                   'Connection': 'close'}
        resp, content = http.request(url, headers=headers)

        if resp['status'] == '200':
            resp_data = json.loads(content.decode('utf-8'))
            self.services = resp_data

            # build the regex that we can use later
            _regex = []
            for each in self.services:
                _regex.append('|'.join(each.get('regex', [])))

            self._regex = re.compile('|'.join(_regex))

        return self.services
def get_services ( self ) : if self . services : return self . services url = 'http://api.embed.ly/1/services/python' http = httplib2 . Http ( timeout = self . timeout ) headers = { 'User-Agent' : self . user_agent , 'Connection' : 'close' } resp , content = http . request ( url , headers = headers ) if resp [ 'status' ] == '200' : resp_data = json . loads ( content . decode ( 'utf-8' ) ) self . services = resp_data _regex = [ ] for each in self . services : _regex . append ( '|' . join ( each . get ( 'regex' , [ ] ) ) ) self . _regex = re . compile ( '|' . join ( _regex ) ) return self . services
get_services makes call to services end point of api.embed.ly to fetch
        the list of supported providers and their regexes