Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions matrix_client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
# limitations under the License.

import json
import logging
import requests
from time import time, sleep
from .errors import MatrixError, MatrixRequestError, MatrixHttpLibError

logger = logging.getLogger(__name__)
logging.captureWarnings(True)

try:
from urllib import quote
except ImportError:
Expand Down Expand Up @@ -62,6 +66,7 @@ def initial_sync(self, limit=1):
Args:
limit (int): The limit= param to provide.
"""
logger.warning('initial_sync is deprecated. Use sync instead', DeprecationWarning)
return self._send("GET", "/initialSync", query_params={"limit": limit})

def sync(self, since=None, timeout_ms=30000, filter=None,
Expand Down Expand Up @@ -192,6 +197,7 @@ def event_stream(self, from_token, timeout=30000):
from_token (str): The 'from' query parameter.
timeout (int): Optional. The 'timeout' query parameter.
"""
logger.warning('event_stream is deprecated. Use sync instead', DeprecationWarning)
path = "/events"
return self._send(
"GET", path, query_params={
Expand Down
3 changes: 2 additions & 1 deletion matrix_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import sys

logger = logging.getLogger(__name__)

logging.captureWarnings(True)

# Cache constants used when instantiating Matrix Client to specify level of caching
class CACHE(Enum):
Expand Down Expand Up @@ -398,6 +398,7 @@ def listen_for_events(self, timeout_ms=30000):
timeout_ms (int): How long to poll the Home Server for before
retrying.
"""
logger.warning("listen_for_events is deprecated", DeprecationWarning)
self._sync(timeout_ms)

def listen_forever(self, timeout_ms=30000, exception_handler=None):
Expand Down