def __get_json(self, url):
        token = os.getenv('GITLAB_TOKEN')
        if not token:
            c = Config()
            token = c.data('gitlab', 'token')
        h = {
                'PRIVATE-TOKEN': token
            }
        r = requests.get(url, headers=h)
        r_json = r.json()
        while True:
            if not r.headers.get('Link'):
                break

            a = re.compile('.*<(.+)>; rel="next".*')
            re_list = a.findall(r.headers.get('Link'))

            if not len(re_list):
                break

            next_link = re_list[0]

            r = requests.get(next_link, headers=h)
            r_json += r.json()

        return r_json
    def __init__(self):
        if hasattr(self, '_init'):
            return

        self._init = True

        c = Config()
        self.auth = HTTPBasicAuth(c.data('gerrit', 'username'),
                                  c.data('gerrit', 'password'))
    def __init__(self):
        if hasattr(self, '_init'):
            return

        self._init = True

        c = Config()
        token = c.data('gitlab', 'token')

        self.basic_headers = {'PRIVATE-TOKEN': token}
    def __init__(self):
        if hasattr(self, '_init'):
            return
        self._init = True

        if os.getenv('GERRIT_USERNAME') and os.getenv('GERRIT_PASSWORD'):
            self.auth = HTTPDigestAuth(os.getenv('GERRIT_USERNAME'), os.getenv('GERRIT_PASSWORD'))
        else:
            c = Config()
            self.auth = HTTPDigestAuth(c.data('gerrit', 'username'), c.data('gerrit', 'password'))

        if CACHE_MODE:
            self.project_data_public = self.__load_from_file('cache/gerrit_public.json')
            self.project_data_all = self.__load_from_file('cache/gerrit_all.json')
        else:
            print('initializing all gerrit project ...')
            self.with_auth = True
            self.project_data_all = self.__init_projects()

            print('initializing public gerrit project ...')
            self.with_auth = False
            self.project_data_public = self.__init_projects()
    def __init__(self):
        if hasattr(self, '_init'):
            return

        self._init = True

        c = Config()
        token = c.data('github', 'token')

        self.basic_headers = {
            'Authorization': 'token %s' % token,
            'Content-Type': 'application/json'
        }
    def __init__(self):
        self.hook = os.getenv('BC_HOOK')

        if not self.hook:
            c = Config()
            self.hook = c.data('bearychat', 'hook')