aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vk/utils/tracking/db/record.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-06-16 02:40:51 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-06-16 02:40:51 +0300
commit8bd8f1f2d09db33697fc61d5caaa3b37b856916d (patch)
treebdb11964cdaf5c985663638f9dbedd5167e3ee4b /vk/utils/tracking/db/record.py
parenttrack_status.py: add a database of statuses (diff)
downloadvk-scripts-8bd8f1f2d09db33697fc61d5caaa3b37b856916d.tar.gz
vk-scripts-8bd8f1f2d09db33697fc61d5caaa3b37b856916d.zip
track_status.py: move stuff to the package
Diffstat (limited to 'vk/utils/tracking/db/record.py')
-rw-r--r--vk/utils/tracking/db/record.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/vk/utils/tracking/db/record.py b/vk/utils/tracking/db/record.py
new file mode 100644
index 0000000..0a1a687
--- /dev/null
+++ b/vk/utils/tracking/db/record.py
@@ -0,0 +1,27 @@
+# Copyright 2016 Egor Tensin <Egor.Tensin@gmail.com>
+# This file is licensed under the terms of the MIT License.
+# See LICENSE.txt for details.
+
+from collections import OrderedDict
+from datetime import datetime
+
+from vk.user import Field
+
+class Record:
+ _FIELDS = (
+ Field.UID,
+ Field.FIRST_NAME,
+ Field.LAST_NAME,
+ Field.SCREEN_NAME,
+ Field.ONLINE,
+ Field.LAST_SEEN,
+ )
+
+ def __init__(self, user):
+ self._fields = OrderedDict()
+ for field in self._FIELDS:
+ self._fields[field] = user[field]
+ self._timestamp = datetime.utcnow().replace(microsecond=0)
+
+ def to_list(self):
+ return [self._timestamp.isoformat()] + list(self._fields.values())