diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-04-08 20:31:26 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-04-08 20:31:26 +0200 |
commit | 95915ef9a9fbfd928469818c2d8cf2e502325226 (patch) | |
tree | d051d91a43d43eedbca4e54983e70ab3f7cc7f0a | |
parent | 5df5bcf625fd1b5c568d5cafc286731e66ab28fa (diff) |
Improved naive ActivityStream object
-rw-r--r-- | pyapd/objects.py | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/pyapd/objects.py b/pyapd/objects.py index 19aa65f..4a97200 100644 --- a/pyapd/objects.py +++ b/pyapd/objects.py @@ -5,13 +5,42 @@ class ActivityObject(): PROPERTIES = [ 'id', 'type', + 'attachment', + 'attributedTo', + 'audience', + 'content', + 'context', + 'contentMap', + 'name', + 'nameMap', + 'endTime', + 'generator', + 'icon', + 'image', + 'inReplyTo', + 'location', + 'preview', + 'published', + 'replies', + 'startTime', + 'summary', + 'summaryMap', + 'tag', + 'updated', + 'url', + 'to', + 'bto', + 'cc', + 'bcc', + 'mediaType', + 'duration', ] def __init__(self, *args, **kw): self.context = "https://www.w3.org/ns/activitystreams" for p in self.PROPERTIES: if p in kw: - setattr(self, p, kw[p]) + setattr(self, "ap_"+p, kw[p]) @classmethod def from_jsons(cls, data: str): @@ -20,7 +49,7 @@ class ActivityObject(): def to_jsonable(self): data = {} for p in self.PROPERTIES: - v = getattr(self, p, None) + v = getattr(self, "ap_"+p, None) if v is not None: data[p] = v return data |