Skip to content

Commit

Permalink
feat(Server-Sent-Events): 🗑️ Deprecation tips for server sent event c…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
MerleLiuKun committed Nov 10, 2023
1 parent 40f329e commit 7bece0b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pyfacebook/api/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import time
from urllib.parse import parse_qsl, urlparse
from typing import Dict, List, Optional, Tuple
from warnings import warn

import requests
from requests import Response
Expand Down Expand Up @@ -827,6 +828,12 @@ def debug_token(self, input_token: str, access_token: Optional[str] = None) -> d


class ServerSentEventAPI:
"""
Notice: Server-Sent Events are deprecated and will be removed December 31, 2023.
Refer: https://developers.facebook.com/docs/graph-api/changelog/version18.0#server-sent-events
"""

STREAM_GRAPH_URL = "https://streaming-graph.facebook.com"

def __init__(
Expand Down Expand Up @@ -856,6 +863,21 @@ def __init__(
self.session = requests.Session()
self.running = False

# Deprecation for this class
warn(
f"{self.__class__.__name__} will be removed at December 31, 2023.",
DeprecationWarning,
stacklevel=2,
)

def __init_subclass__(cls, **kwargs):
warn(
f"{cls.__name__} will be removed at December 31, 2023.",
DeprecationWarning,
stacklevel=2,
)
super().__init_subclass__(**kwargs)

def _connect(self, url: str, params: dict) -> None:
"""
:param url: endpoint for facebook.
Expand Down

0 comments on commit 7bece0b

Please sign in to comment.