Skip to content

Commit b80c5e3

Browse files
committed
Deprecate all legacy codes
1 parent 9b445a2 commit b80c5e3

20 files changed

+200
-0
lines changed

linebot/aiohttp_async_http_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616

1717
from linebot import AsyncHttpClient, AsyncHttpResponse
1818

19+
from deprecated import deprecated
20+
from linebot.deprecations import LineBotSdkDeprecatedIn30
1921

22+
23+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2024
class AiohttpAsyncHttpClient(AsyncHttpClient):
2125
"""HttpClient implemented by requests."""
2226

@@ -113,6 +117,7 @@ async def put(self, url, headers=None, data=None, timeout=None):
113117
return AiohttpAsyncHttpResponse(response)
114118

115119

120+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
116121
class AiohttpAsyncHttpResponse(AsyncHttpResponse):
117122
"""AsyncHttpResponse implemented by aiohttp's response."""
118123

linebot/async_http_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020

2121
from future.utils import with_metaclass
2222

23+
from deprecated import deprecated
24+
from linebot.deprecations import LineBotSdkDeprecatedIn30
2325

26+
27+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2428
class AsyncHttpClient(with_metaclass(ABCMeta)):
2529
"""Abstract Base Classes of HttpClient."""
2630

@@ -108,6 +112,7 @@ async def put(self, url, headers=None, data=None, timeout=None):
108112
raise NotImplementedError
109113

110114

115+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
111116
class AsyncHttpResponse(with_metaclass(ABCMeta)):
112117
"""HttpResponse."""
113118

linebot/constants/postback_input_option.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212

1313
"""linebot.constants.postback_input_option module."""
1414

15+
from deprecated import deprecated
16+
from linebot.deprecations import LineBotSdkDeprecatedIn30
1517

18+
19+
@deprecated(reason="Use 'from linebot.v3.messaging import PostbackAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
1620
class PostbackInputOption:
1721
"""Constant class for Postback input option."""
1822

linebot/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
)
2626

2727

28+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2829
class BaseError(with_metaclass(ABCMeta, Exception)):
2930
"""Base Exception class."""
3031

@@ -60,6 +61,7 @@ def __init__(self, message='-'):
6061
super(InvalidSignatureError, self).__init__(message)
6162

6263

64+
@deprecated(reason="Use 'from linebot.v3.messaging.exceptions import ApiException' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
6365
class LineBotApiError(BaseError):
6466
"""When LINE Messaging API response error, this error will be raised."""
6567

linebot/http_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
import requests
2121
from future.utils import with_metaclass
2222

23+
from deprecated import deprecated
24+
from linebot.deprecations import LineBotSdkDeprecatedIn30
2325

26+
27+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2428
class HttpClient(with_metaclass(ABCMeta)):
2529
"""Abstract Base Classes of HttpClient."""
2630

@@ -109,6 +113,7 @@ def put(self, url, headers=None, data=None, timeout=None):
109113
raise NotImplementedError
110114

111115

116+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
112117
class RequestsHttpClient(HttpClient):
113118
"""HttpClient implemented by requests."""
114119

@@ -217,6 +222,7 @@ def put(self, url, headers=None, data=None, timeout=None):
217222
return RequestsHttpResponse(response)
218223

219224

225+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
220226
class HttpResponse(with_metaclass(ABCMeta)):
221227
"""HttpResponse."""
222228

@@ -255,6 +261,7 @@ def iter_content(self, chunk_size=1024, decode_unicode=False):
255261
raise NotImplementedError
256262

257263

264+
@deprecated(reason="Use 'linebot.v3' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
258265
class RequestsHttpResponse(HttpResponse):
259266
"""HttpResponse implemented by requests lib's response."""
260267

linebot/models/actions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
from .base import Base
2323

24+
from deprecated import deprecated
25+
from linebot.deprecations import LineBotSdkDeprecatedIn30
26+
2427

2528
def get_action(action):
2629
"""Get action."""
@@ -51,6 +54,7 @@ def get_actions(actions):
5154
return new_actions
5255

5356

57+
@deprecated(reason="Use 'linebot.v3.messaging' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
5458
class Action(with_metaclass(ABCMeta, Base)):
5559
"""Abstract base class of Action."""
5660

@@ -64,6 +68,7 @@ def __init__(self, **kwargs):
6468
self.type = None
6569

6670

71+
@deprecated(reason="Use 'from linebot.v3.messaging import PostbackAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
6772
class PostbackAction(Action):
6873
"""PostbackAction.
6974
@@ -105,6 +110,7 @@ def __init__(
105110
self.fill_in_text = fill_in_text
106111

107112

113+
@deprecated(reason="Use 'from linebot.v3.messaging import MessageAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
108114
class MessageAction(Action):
109115
"""MessageAction.
110116
@@ -128,6 +134,7 @@ def __init__(self, label=None, text=None, **kwargs):
128134
self.text = text
129135

130136

137+
@deprecated(reason="Use 'from linebot.v3.messaging import URIAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
131138
class URIAction(Action):
132139
"""URIAction.
133140
@@ -155,6 +162,7 @@ def __init__(self, label=None, uri=None, alt_uri=None, **kwargs):
155162
self.alt_uri = self.get_or_new_from_json_dict(alt_uri, AltUri)
156163

157164

165+
@deprecated(reason="Use 'from linebot.v3.messaging import AltUri' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
158166
class AltUri(with_metaclass(ABCMeta, Base)):
159167
"""AltUri.
160168
@@ -177,6 +185,7 @@ def __init__(self, desktop=None, **kwargs):
177185
self.desktop = desktop
178186

179187

188+
@deprecated(reason="Use 'from linebot.v3.messaging import DatetimePickerAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
180189
class DatetimePickerAction(Action):
181190
"""DatetimePickerAction.
182191
@@ -217,6 +226,7 @@ def __init__(self, label=None, data=None, mode=None,
217226
self.min = min
218227

219228

229+
@deprecated(reason="Use 'from linebot.v3.messaging import CameraAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
220230
class CameraAction(Action):
221231
"""CameraAction.
222232
@@ -239,6 +249,7 @@ def __init__(self, label=None, **kwargs):
239249
self.label = label
240250

241251

252+
@deprecated(reason="Use 'from linebot.v3.messaging import CameraRollAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
242253
class CameraRollAction(Action):
243254
"""CameraRollAction.
244255
@@ -261,6 +272,7 @@ def __init__(self, label=None, **kwargs):
261272
self.label = label
262273

263274

275+
@deprecated(reason="Use 'from linebot.v3.messaging import LocationAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
264276
class LocationAction(Action):
265277
"""LocationRollAction.
266278
@@ -283,6 +295,7 @@ def __init__(self, label=None, **kwargs):
283295
self.label = label
284296

285297

298+
@deprecated(reason="Use 'from linebot.v3.messaging import RichMenuSwitchAction' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
286299
class RichMenuSwitchAction(Action):
287300
"""RichMenuSwitchAction.
288301

linebot/models/background.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121

2222
from .base import Base
2323

24+
from deprecated import deprecated
25+
from linebot.deprecations import LineBotSdkDeprecatedIn30
2426

27+
28+
@deprecated(reason="Use 'linebot.v3.messaging' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2529
class Background(with_metaclass(ABCMeta, Base)):
2630
"""Background."""
2731

@@ -35,6 +39,7 @@ def __init__(self, **kwargs):
3539
self.type = None
3640

3741

42+
@deprecated(reason="Use 'from linebot.v3.messaging import FlexBoxLinearGradient' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
3843
class LinearGradientBackground(Background):
3944
"""LinearGradientBackground."""
4045

linebot/models/emojis.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121

2222
from .base import Base
2323

24+
from deprecated import deprecated
25+
from linebot.deprecations import LineBotSdkDeprecatedIn30
2426

27+
28+
@deprecated(reason="Use 'from linebot.v3.messaging import Emoji' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2529
class Emojis(with_metaclass(ABCMeta, Base)):
2630
"""Emojis.
2731

linebot/models/error.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
from .base import Base
1919

20+
from deprecated import deprecated
21+
from linebot.deprecations import LineBotSdkDeprecatedIn30
2022

23+
24+
@deprecated(reason="Use 'from linebot.v3.messaging import ErrorResponse' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2125
class Error(Base):
2226
"""Error response of LINE messaging API.
2327
@@ -45,6 +49,7 @@ def __init__(self, message=None, details=None, **kwargs):
4549
self.details = new_details
4650

4751

52+
@deprecated(reason="Use 'from linebot.v3.messaging import ErrorDetail' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
4853
class ErrorDetail(Base):
4954
"""ErrorDetail response of LINE messaging API."""
5055

linebot/models/filter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121

2222
from .base import Base
2323

24+
from deprecated import deprecated
25+
from linebot.deprecations import LineBotSdkDeprecatedIn30
2426

27+
28+
@deprecated(reason="Use 'linebot.v3.messaging' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
2529
class Filter(with_metaclass(ABCMeta, Base)):
2630
"""Filter.
2731
@@ -44,6 +48,7 @@ def __init__(self, demographic=None, **kwargs):
4448
self.demographic = demographic
4549

4650

51+
@deprecated(reason="Use 'linebot.v3.messaging' module instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
4752
class DemographicFilter(Filter):
4853
"""DemographicFilter.
4954
@@ -65,6 +70,7 @@ def __init__(self, **kwargs):
6570
self.type = None
6671

6772

73+
@deprecated(reason="Use 'from linebot.v3.messaging import GenderDemographicFilter' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
6874
class GenderFilter(DemographicFilter):
6975
"""GenderFilter."""
7076

@@ -85,6 +91,7 @@ def __init__(self, one_of=None, **kwargs):
8591
self.one_of = one_of
8692

8793

94+
@deprecated(reason="Use 'from linebot.v3.messaging import AppTypeDemographicFilter' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
8895
class AppTypeFilter(DemographicFilter):
8996
"""AppTypeFilter."""
9097

@@ -105,6 +112,7 @@ def __init__(self, one_of=None, **kwargs):
105112
self.one_of = one_of
106113

107114

115+
@deprecated(reason="Use 'from linebot.v3.messaging import AreaDemographicFilter' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
108116
class AreaFilter(DemographicFilter):
109117
"""AreaFilter."""
110118

@@ -123,6 +131,7 @@ def __init__(self, one_of=None, **kwargs):
123131
self.one_of = one_of
124132

125133

134+
@deprecated(reason="Use 'from linebot.v3.messaging import AgeDemographicFilter' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
126135
class AgeFilter(DemographicFilter):
127136
"""AgeFilter.
128137
@@ -147,6 +156,7 @@ def __init__(self, gte=None, lt=None, **kwargs):
147156
self.lt = lt
148157

149158

159+
@deprecated(reason="Use 'from linebot.v3.messaging import SubscriptionPeriodDemographicFilter' instead. See https://github.com/line/line-bot-sdk-python/blob/master/README.rst for more details.", version='3.0.0', category=LineBotSdkDeprecatedIn30) # noqa: E501
150160
class SubscriptionPeriodFilter(DemographicFilter):
151161
"""SubscriptionPeriodFilter.
152162

0 commit comments

Comments
 (0)