diff --git a/fbchat/_client.py b/fbchat/_client.py index a74a3b5..4f6e5a9 100644 --- a/fbchat/_client.py +++ b/fbchat/_client.py @@ -70,6 +70,9 @@ class Client: self._session = session self._uid = session.user_id + def __repr__(self): + return "Client(session={!r})".format(self._session) + """ INTERNAL REQUEST METHODS """ diff --git a/fbchat/_session.py b/fbchat/_session.py index 7222d7b..581813f 100644 --- a/fbchat/_session.py +++ b/fbchat/_session.py @@ -5,7 +5,7 @@ import requests import random import urllib.parse -from ._core import log, attrs_default +from ._core import log, kw_only from . import _graphql, _util, _exception FB_DTSG_REGEX = re.compile(r'name="fb_dtsg" value="(.*?)"') @@ -98,7 +98,7 @@ def _2fa_helper(session, code, r): return r -@attrs_default +@attr.s(slots=True, kw_only=kw_only, repr=False) class Session: """Stores and manages state required for most Facebook requests. @@ -118,6 +118,10 @@ class Session: """The logged in user's ID.""" return self._user_id + def __repr__(self): + # An alternative repr, to illustrate that you can't create the class directly + return "".format(self._user_id) + def _get_params(self): self._counter += 1 # TODO: Make this operation atomic / thread-safe return {