diff --git a/twitter-langchain/twitter_langchain/twitter_api_wrapper.py b/twitter-langchain/twitter_langchain/twitter_api_wrapper.py index 7e57a6ac3..8f84dc4f0 100644 --- a/twitter-langchain/twitter_langchain/twitter_api_wrapper.py +++ b/twitter-langchain/twitter_langchain/twitter_api_wrapper.py @@ -21,9 +21,8 @@ def validate_environment(cls, values: dict) -> Any: api_key = get_from_dict_or_env(values, "twitter_api_key", "TWITTER_API_KEY") api_secret = get_from_dict_or_env(values, "twitter_api_secret", "TWITTER_API_SECRET") access_token = get_from_dict_or_env(values, "twitter_access_token", "TWITTER_ACCESS_TOKEN") - access_token_secret = get_from_dict_or_env( - values, "twitter_access_token_secret", "TWITTER_ACCESS_TOKEN_SECRET" - ) + access_token_secret = get_from_dict_or_env(values, "twitter_access_token_secret", "TWITTER_ACCESS_TOKEN_SECRET") + bearer_token = get_from_dict_or_env(values, "twitter_bearer_token", "TWITTER_BEARER_TOKEN") try: import tweepy @@ -31,7 +30,7 @@ def validate_environment(cls, values: dict) -> Any: raise ImportError( "Tweepy Twitter SDK is not installed. " -"Please install it with `pip install tweepy`" + "Please install it with `pip install tweepy`" ) from None client = tweepy.Client( @@ -39,6 +38,7 @@ def validate_environment(cls, values: dict) -> Any: consumer_secret=api_secret, access_token=access_token, access_token_secret=access_token_secret, + bearer_token=bearer_token, ) values["client"] = client @@ -46,6 +46,7 @@ def validate_environment(cls, values: dict) -> Any: values["api_secret"] = api_secret values["access_token"] = access_token values["access_token_secret"] = access_token_secret + values["bearer_token"] = bearer_token return values