Example #1
0
    def get_token(self, code):
        """ Get gitcafe access token

        :type code: str
        :param code:

        :rtype: str
        :return: access token
        """
        token_resp = get_remote(get_config("login.gitcafe.access_token_url") + code)
        query = qs_dict(token_resp)
        if query.get("error") is not None:
            raise Exception(query)

        return query["access_token"]
Example #2
0
    def get_token(self, code):
        """ Get gitcafe access token

        :type code: str
        :param code:

        :rtype: str
        :return: access token
        """
        token_resp = get_remote(
            get_config("login.gitcafe.access_token_url") + code)
        query = qs_dict(token_resp)
        if query.get("error") is not None:
            raise Exception(query)

        return query["access_token"]
Example #3
0
    def get_token(self, code):
        """ Get qq access token

        :type code: str
        :param code:

        :rtype: str
        :return: access token
        """

        state = "openhackathon"
        token_resp = get_remote(get_config("login.qq.access_token_url") + code + "&state=" + state)
        if token_resp.find('callback') == 0:
            error = json.loads(token_resp[10:-4])
            raise Exception(error)

        query = qs_dict(token_resp)
        return query["access_token"]
Example #4
0
    def get_token(self, code):
        """ Get qq access token

        :type code: str
        :param code:

        :rtype: str
        :return: access token
        """

        state = "openhackathon"
        token_resp = get_remote(get_config("login.qq.access_token_url") + code + "&state=" + state)
        if token_resp.find('callback') == 0:
            error = json.loads(token_resp[10:-4])
            raise Exception(error)

        query = qs_dict(token_resp)
        return query["access_token"]