From 4705f62d716e7f4e3c6f4479daf3e31113dd11eb Mon Sep 17 00:00:00 2001 From: DefiDebauchery <75273961+DefiDebauchery@users.noreply.github.com> Date: Wed, 14 Apr 2021 17:33:19 -0400 Subject: [PATCH] Update TweepError calls to TweepyException The Error module was updated to TweepyException and needs to be reflected in the async stream. --- tweepy/asynchronous/__init__.py | 4 ++-- tweepy/asynchronous/streaming.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tweepy/asynchronous/__init__.py b/tweepy/asynchronous/__init__.py index bc1200a..aac29bb 100644 --- a/tweepy/asynchronous/__init__.py +++ b/tweepy/asynchronous/__init__.py @@ -11,7 +11,7 @@ Asynchronous interfaces with the Twitter API try: import aiohttp except ModuleNotFoundError: - from tweepy.error import TweepError - raise TweepError("tweepy.asynchronous requires aiohttp to be installed") + from tweepy.errors import TweepyException + raise TweepyException("tweepy.asynchronous requires aiohttp to be installed") from tweepy.asynchronous.streaming import AsyncStream diff --git a/tweepy/asynchronous/streaming.py b/tweepy/asynchronous/streaming.py index c5a1a37..da3c04c 100644 --- a/tweepy/asynchronous/streaming.py +++ b/tweepy/asynchronous/streaming.py @@ -13,7 +13,7 @@ from oauthlib.oauth1 import Client as OAuthClient from yarl import URL import tweepy -from tweepy.error import TweepError +from tweepy.errors import TweepyException from tweepy.models import Status log = logging.getLogger(__name__) @@ -165,7 +165,7 @@ class AsyncStream: Returns :class:`asyncio.Task` """ if self.task is not None and not self.task.done(): - raise TweepError("Stream is already connected") + raise TweepyException("Stream is already connected") endpoint = "statuses/filter" headers = {"Content-Type": "application/x-www-form-urlencoded"} @@ -177,7 +177,7 @@ class AsyncStream: body["track"] = ','.join(map(str, track)) if locations is not None: if len(locations) % 4: - raise TweepError( + raise TweepyException( "Number of location coordinates should be a multiple of 4" ) body["locations"] = ','.join( @@ -207,7 +207,7 @@ class AsyncStream: Returns :class:`asyncio.Task` """ if self.task is not None and not self.task.done(): - raise TweepError("Stream is already connected") + raise TweepyException("Stream is already connected") endpoint = "statuses/sample" -- 2.25.1