Skip to content

Commit 9b81365

Browse files
committed
Privatize fb_h and client_id variables
These are sparsely used and badly named, so probably not externally depended on externally
1 parent a079797 commit 9b81365

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

fbchat/_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def _resetValues(self):
303303

304304
def _postLogin(self):
305305
self.payloadDefault = OrderedDict()
306-
self.client_id = hex(int(random() * 2147483648))[2:]
306+
self._client_id = hex(int(random() * 2147483648))[2:]
307307
self.uid = self._session.cookies.get_dict().get("c_user")
308308
if self.uid is None:
309309
raise FBchatException("Could not find c_user cookie")
@@ -320,7 +320,7 @@ def _postLogin(self):
320320

321321
fb_h_element = soup.find("input", {"name": "h"})
322322
if fb_h_element:
323-
self.fb_h = fb_h_element["value"]
323+
self._fb_h = fb_h_element["value"]
324324

325325
ttstamp = ""
326326
for i in fb_dtsg:
@@ -510,11 +510,11 @@ def logout(self):
510510
:return: True if the action was successful
511511
:rtype: bool
512512
"""
513-
if not hasattr(self, "fb_h"):
513+
if not hasattr(self, "_fb_h"):
514514
h_r = self._post(self.req_url.MODERN_SETTINGS_MENU, {"pmid": "4"})
515-
self.fb_h = re.search(r'name=\\"h\\" value=\\"(.*?)\\"', h_r.text).group(1)
515+
self._fb_h = re.search(r'name=\\"h\\" value=\\"(.*?)\\"', h_r.text).group(1)
516516

517-
data = {"ref": "mb", "h": self.fb_h}
517+
data = {"ref": "mb", "h": self._fb_h}
518518

519519
r = self._get(self.req_url.LOGOUT, data)
520520

@@ -1254,7 +1254,7 @@ def _getSendData(self, message=None, thread_id=None, thread_type=ThreadType.USER
12541254
"source": "source:chat:web",
12551255
"offline_threading_id": messageAndOTID,
12561256
"message_id": messageAndOTID,
1257-
"threading_id": generateMessageID(self.client_id),
1257+
"threading_id": generateMessageID(self._client_id),
12581258
"ephemeral_ttl_mode:": "0",
12591259
}
12601260

@@ -2377,7 +2377,7 @@ def unmuteThreadMentions(self, thread_id=None):
23772377
def _ping(self):
23782378
data = {
23792379
"channel": "p_" + self.uid,
2380-
"clientid": self.client_id,
2380+
"clientid": self._client_id,
23812381
"partition": -2,
23822382
"cap": 0,
23832383
"uid": self.uid,
@@ -2394,7 +2394,7 @@ def _pullMessage(self):
23942394
"msgs_recv": 0,
23952395
"sticky_token": self.sticky,
23962396
"sticky_pool": self.pool,
2397-
"clientid": self.client_id,
2397+
"clientid": self._client_id,
23982398
"state": "active" if self._markAlive else "offline",
23992399
}
24002400
return self._get(self.req_url.STICKY, data, fix_request=True, as_json=True)

0 commit comments

Comments
 (0)