Move request payload into State model

This commit is contained in:
Mads Marquart
2019-07-01 13:30:22 +02:00
parent 78c307780b
commit f07122d446
2 changed files with 32 additions and 21 deletions

23
fbchat/_state.py Normal file
View File

@@ -0,0 +1,23 @@
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import attr
from . import _util
@attr.s(slots=True, kw_only=True)
class State(object):
"""Stores and manages state required for most Facebook requests."""
fb_dtsg = attr.ib(None)
_revision = attr.ib(None)
def get_params(self):
if self.fb_dtsg is None:
return {}
return {
"__a": 1,
"__rev": self._revision,
"fb_dtsg": self.fb_dtsg,
}