Exemplo n.º 1
0
    def __init__(self, access_token=None, access_token_secret=None, consumer_key=None, consumer_secret=None,
                 key_cert=None, header_auth=None):

        # Determine the appropriate signing type
        if key_cert is not None:
            self.signature = CustomSignatureMethod_RSA_SHA1()
            self.signature.key_cert = key_cert
        else:
            self.signature = CustomSignatureMethod_HMAC_SHA1()

        """
        Consumer is compulsory, while the user's Token can be retrieved through the API
        """
        if access_token is not None:
            self.token = Token(access_token, access_token_secret)
        else:
            self.token = None

        if consumer_key is None and consumer_secret is None:
            consumer_key = self.consumer_key
            consumer_secret = self.consumer_secret

        if header_auth is not None:
            self.header_auth = header_auth

        self.consumer = Consumer(consumer_key, consumer_secret)
Exemplo n.º 2
0
    def __init__(self,
                 access_token=None,
                 access_token_secret=None,
                 consumer_key=None,
                 consumer_secret=None):
        """
        Consumer is compulsory, while the user's Token can be retrieved through the API
        """
        if access_token is not None and access_token_secret is not None:
            self.token = Token(access_token, access_token_secret)
        else:
            self.token = None

        if consumer_key is None and consumer_secret is None:
            consumer_key = self.consumer_key
            consumer_secret = self.consumer_secret

        self.consumer = Consumer(consumer_key, consumer_secret)