Skip to content

Commit 861fb20

Browse files
committed
Added Deprecation Warning
1 parent 11b4e9a commit 861fb20

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scrapingbee/client.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1+
import warnings
2+
from functools import wraps
3+
14
from requests import Response, Session
25
from requests.adapters import HTTPAdapter
36
from urllib3.util import Retry
47

58
from .utils import process_headers, process_params
69

10+
def deprecated(reason):
11+
"""Decorator to mark functions as deprecated."""
12+
def decorator(func):
13+
@wraps(func)
14+
def wrapper(*args, **kwargs):
15+
warnings.warn(
16+
f"{func.__name__}() is deprecated. {reason}",
17+
category=DeprecationWarning,
18+
stacklevel=2
19+
)
20+
return func(*args, **kwargs)
21+
return wrapper
22+
return decorator
23+
724

825
class ScrapingBeeClient:
926
# API Endpoints
@@ -59,6 +76,7 @@ def request(
5976
# HTML API (Legacy - WILL BE REMOVED)
6077
# ============================================
6178

79+
@deprecated("Please use html_api() instead. This method will be removed in version 2.0.0.")
6280
def get(
6381
self,
6482
url: str,
@@ -89,6 +107,7 @@ def get(
89107
**kwargs
90108
)
91109

110+
@deprecated("Please use html_api() instead. This method will be removed in version 2.0.0.")
92111
def post(
93112
self,
94113
url: str,

0 commit comments

Comments
 (0)