diff --git a/lib/common.py b/lib/common.py index 25d7089..3ef71dd 100644 --- a/lib/common.py +++ b/lib/common.py @@ -45,6 +45,15 @@ class WorkPlace(): data['date[current]'] = 'on' return data + @classmethod + def from_dict(cls,data:dict): + self = cls() + for k,v in data.items(): + if hasattr(self,k): + setattr(self,k,v) + return self + + @attrs(cmp=False) class College(): diff --git a/lib/facebook.py b/lib/facebook.py index af045a9..dbc0bf9 100644 --- a/lib/facebook.py +++ b/lib/facebook.py @@ -156,7 +156,10 @@ class RequestSource(): @classmethod def get(cls, channel): if isinstance(channel, str): - channel = int(channel) + try: + channel = int(channel) + except: + pass return cls.const.get(channel, channel)